<template>
  <div class="page" ref="page"  @click="closePop">
    <!-- 展示列表模块 -->
    <div class="top" style="width:100%!important;padding:0;">
      <div class="tip_2" >特别提示: 配置改变后,请及时同步到设备,否则可能会引起数据错乱!</div>
      <el-dropdown placement="bottom" @command="handleCommand" trigger="click"
      	style="float:right; margin-left:0.2rem;margin-right:0.3rem;">
      	<span type="primary" style="color:#409eff;cursor: pointer;">
      		更多<i class="el-icon-arrow-down el-icon--right"></i>
      	</span>
      	<el-dropdown-menu slot="dropdown">
      		<el-dropdown-item command="group">分组管理</el-dropdown-item>
          <el-dropdown-item command="virtual" >新增虚拟数据点</el-dropdown-item>
      		<el-dropdown-item v-if="domains.length>1 && !manyFilterVisible" command="filter">批量筛选</el-dropdown-item>
      		<el-dropdown-item v-if="domains.length>1" command="update">批量修改</el-dropdown-item>
      		<el-dropdown-item v-if="domains.length>1" command="delete">批量删除</el-dropdown-item>
      	</el-dropdown-menu>
      </el-dropdown>

      <el-button @click="cancelConnect" type="primary" size="mini" id="goback"
        v-if="isExam && domains.length">关闭调试
      </el-button>
      <el-button @click="examConnect" type="primary" size="mini" id="goback"  :disabled="!isOn || !domains.length"
        :title="!isOn?'设备离线或没有变量时，不能调试':''" v-if="!isExam">设备调试
      </el-button>
      <el-button type="primary" size="mini" id="goback" style="margin-right:0.18rem;"  :title="!isOn?'设备离线，不能下发':''"
         :disabled="!slaveId || canSet || !isOn" @click="sendSet">下发配置
      </el-button>

      <el-button type="primary" size="mini" id="goback"  :title="!isOn?'设备离线，不能读取':''"
        :disabled="!isOn" @click="readSet">读取配置
      </el-button>
      <el-button @click="addSensors('real')" type="primary" size="mini" id="goback" style="margin-left:0.2rem;" >新增数据点</el-button>
      <div style="float:right;margin-right:0.3rem;height:1rem;line-height:1rem;font-size:0.3rem;">当前数据点所属子设备：<span
            style="color:red;">{{slaveName}}</span><span>　　数据点数量：{{domains.length}}</span></div>
    </div>

    <!-- 左侧端口配置 -->
    <div id="channel" ref="channel" :class="showChannel?'channel':'channelHidden'">
      <span class="channelBack" @click="showChannel=false" v-if="showChannel"><i class="el-icon-back"></i></span>
      <div class="header_bottom" style="text-align:center;">
        <!-- 用于暂不支持多端口，临时禁用此添加-->
        <el-button size="mini" type="primary" class="btn_1360"
          @click="preAddChannel">添加端口</el-button>
        <el-button size="mini" type="primary"  class="btn_1360"
          @click="preAddSlave">添加子设备</el-button>
        <!-- <el-button :disabled="!deviceData.slaves_count" size="mini" type="primary" style="padding:4px;" class="btn_1360"
          @click="copySlave">复制子设备</el-button> -->
        <!-- <el-button :disabled="true" size="mini" type="primary" style="padding:4px;" class="btn_1360"
           @click="copySlave">复制子设备</el-button> -->
        <!-- <el-button size="small"  type="primary"  @click="getChannel">刷新端口</el-button> -->
      </div>
      <el-tree v-if="channelSlaves.length" style="width:100%;font-size:0.3rem;text-align:justify;margin-top:0.2rem;" ref="tree"
        :data="channelSlaves" node-key="id" default-expand-all :expand-on-click-node="false" :indent="14">
        <span slot-scope="{ node, data }" class="custom-tree-node" :class="node.level==1?'channel_sign':''"
          @click="() => getInfo(node,data)">
          <!-- <span v-if="node.level==1">端口{{data.index}}：{{ channelToUpper(data.label) }}</span> -->
          <span v-if="node.level==1"><img class="channelIcon" src="../../static/duankou_1.png"/>：{{ channelToUpper(data.label) }}</span>
          <span v-else class="slaveLine over" :class="data.id==slaveId?'slaveActtive':''"><i class="el-icon-s-tools" style="color:deepskyblue;font-size:0.35rem;vertical-align: middle;"></i>:{{ node.label }}</span>
          <span>
            <i v-if="!(node.level==1 && data.label.indexOf('ocal')>=0)" style="font-size:0.4rem;color:#409Eff;" class="el-icon-edit-outline" @click="() => edit(node,data)">
            </i>
            <i v-if="node.level==2 && node.parent.data.label.indexOf('ocal')<0" style="font-size:0.4rem;color:#409Eff;" class="el-icon-document-copy" @click="() => copySlave(node,data)">
            </i>

            <i style="font-size:0.4rem;color:#f56c6c;" class="el-icon-delete" @click="() => remove(node, data)">
            </i>
          </span>
        </span>
      </el-tree>
      <!-- 端口详情展示区 -->
      <div class="infobox" v-if="infoShow=='channel' && channelInfo">
        <ChannelInfo :channelInfo="channelInfo" :channelTip="channelTip" :version="deviceData.version" :isRead="false"/>
        <!-- <ChannelInfo :channelInfo="channelInfo" :channelTip="deviceData.run_mode==1?channelTip:''"/> -->
      </div>
      <!-- 子设备详情展示区 -->
      <div class="infobox" v-if="infoShow=='slave' && slaveInfo.slave_protocol">
        <SlaveInfo :slaveInfo="slaveInfo" :slaveTip="slaveTip" :styleObj="{}" :version="deviceData.version" />
      </div>
    </div>
    <!-- 中隔线 -->
    <div class="midLine" v-if="showChannel"></div>
    <!-- 右侧子设备配置 -->
    <div ref="slave" :class="showChannel?'slave':'slaveScreen'" v-loading.fullscreen="loading"
      element-loading-text="正在向设备下发配置,请稍等..." element-loading-spinner="el-icon-loading">
      <span class="channelShow" @click="showChannel=true" v-if="!showChannel"><i class="el-icon-right"></i></span>
      <!-- <div class="btnBox" v-show="slaveId">
        <div style="float:left;margin-right:0.3rem;height:1rem;line-height:1rem;font-size:0.3rem;">当前数据点所属子设备：<span
              style="color:red;">{{slaveName}}</span> -->
          <!-- <span style="font-size:0.3rem;margin-right:0.2rem;">当前数据点所属子设备：<span
              style="color:red;">{{slaveName}}</span></span> -->
         <!-- <span style="font-size:0.3rem;">数据点模板:</span>
          <el-select v-model="setForm.template_name" placeholder="选择模板" class="inpu"
            style="vertical-align:bottom;width:5rem;" @change="changeTemplate">
            <el-option v-for="item in moulds" :key="item.value" :value="item.value" :label="item.label"
              :readonly="only">
            </el-option>
          </el-select> -->
          <!-- <span v-show="setForm.template_name!=0" style="font-size:0.3rem;">选择分组:</span>
          <el-select v-show="setForm.template_name!=0" v-model="setForm.sgroup_id" placeholder="选择分组" class="inpu"
            style="vertical-align:bottom;width:5rem;">
            <el-option v-for="item in groups" :key="item.value" :value="item.value" :label="item.label"
              :readonly="only">
            </el-option>
          </el-select> -->
        <!-- </div> -->
        <!-- <el-button @click="deleteMany" type="danger" size="mini" :class="hasScroll?'mar_right_2':'mar_right_3'" style="margin-left:0.3rem;float:right;margin-top: 0.22rem;"
          v-if="domains.length>1">批量删除
        </el-button>
        <el-button @click="updateMany" type="primary" size="mini" style="margin-left:0.3rem;float:right;margin-top: 0.22rem;"
          v-if="domains.length>1">批量修改
        </el-button>
        <el-button @click="filterMany" type="primary" size="mini" style="margin-left:0.3rem;float:right;margin-top: 0.22rem;"
          v-if="domains.length>1 && !screen_1360 && !manyFilterVisible">批量筛选
        </el-button>
        <el-button @click="cancelConnect" type="primary" size="mini" style="margin-left:0.3rem;float:right;margin-top: 0.22rem;"
          v-if="isExam && domains.length">关闭调试
        </el-button>
        <el-button @click="examConnect" type="primary" size="mini" style="margin-left:0.3rem;float:right;margin-top: 0.22rem;" :disabled="!isOn"
          :title="!isOn?'设备离线，不能调试':''" v-if="!isExam && domains.length">设备调试
        </el-button>
        <el-button @click="addSensors('virtual')" type="primary" size="mini" style="margin-left:0.3rem;float:right;margin-top: 0.22rem;">新增虚拟数据点</el-button>
        <el-button @click="addSensors('real')" type="primary" size="mini" style="float:right;margin-top: 0.22rem;" >新增数据点</el-button> -->





        <!-- <el-button @click="sendTemplate" type="primary" size="mini" style="margin-left:0;"
          v-if="setForm.template_name==0 && domains.length">导出为模板
        </el-button> -->
        <!-- <el-button type="success" size="mini" @click="modifySet" style="margin-left:0;"
          v-if="setForm.template_name!=0">保存</el-button>
        <span v-if="setForm.template_name!=0"
          style="color: red;font-size:0.3rem;margin-left:0.2rem;">使用模板配置，请先保存后下发</span> -->
      <!-- </div> -->
      <SensorSetList :appScene="deviceData.app_scene" :setForm="setForm" :slaveId="slaveId" :domains="domains"
        :domains2="domains2" :isExam="isExam" :baseurl="baseurl" :showUpdate="showUpdate" :updateOne="updateOne"
        :sureDeleteSensor="sureDeleteSensor" :changeVal="changeVal" :isAll="isAll" :chooseAll="chooseAll"
        :chooseOne="chooseOne" :chooseIcon="chooseIcon" :getIndex="getIndex" />
      </SensorSetList>
      <!-- 下面是测试父组件调用子组件方法 -->
      <!-- <SensorSetList :appScene="deviceData.app_scene" ref="sensorList" :setForm="setForm"   :slaveId="slaveId"  :domains="domains" :domains2="domains2" :isExam="isExam" :baseurl="baseurl" :showUpdate="showUpdate"  :updateOne="updateOne" :sureDeleteSensor="sureDeleteSensor" :changeVal="changeVal" :isAll="isAll" :chooseAll="chooseAll" :chooseOne="chooseOne" :chooseIcon="chooseIcon" :getIndex="getIndex"/> -->
      <!-- 下面是测试子组件调用父组件方法 -->
      <!-- <SensorSetList :appScene="deviceData.app_scene"  :setForm="setForm" @fatherMethod="fatherMethod"  :slaveId="slaveId"  :domains="domains" :domains2="domains2" :isExam="isExam" :baseurl="baseurl" :showUpdate="showUpdate"  :updateOne="updateOne" :sureDeleteSensor="sureDeleteSensor" :changeVal="changeVal" :isAll="isAll" :chooseAll="chooseAll" :chooseOne="chooseOne" :chooseIcon="chooseIcon" :getIndex="getIndex"/> -->

      <el-dialog :visible.sync="dialogFormVisible" v-el-dialog-drag v-el-dialog-drag-width
        :width="screenWidth>1600?'60%':'75%'" append-to-body :show-close="close" :close-on-click-modal="false"
        top="60px" class="dial">
        <div class="toptit">
          <span>{{addForm.is_virtual==1?'新增虚拟数据点':'新增数据点'}}</span>
          <span style="float:right;cursor: pointer;" @click="cancelAdd">关闭</span>
        </div>
        <el-form :model="addForm" style="text-align: left;" inline>
          <div class="slaveInfo_3">
            <span style="font-size:0.3rem;font-weight: 600;">从属信息：</span>
            <span>当前端口：{{channelToUpper(addForm.channel_type)}}</span>
            <span style="margin-left:0.4rem;">当前子设备：<span style="color:red;">{{addForm.slave_name}}</span></span>
            <span v-if="addForm.is_virtual==0"
              style="margin-left:0.4rem;">当前协议：{{protocolToUpper(addForm.slave_protocol)}}</span>
          </div>
          <div v-if="addForm.slave_protocol.indexOf('645')<0 && addForm.is_virtual==0" class="slaveInfo_3"
            style="height:1.4rem;padding-top:0.1rem;display:inline-block;vertical-align: middle;">
            <span style="font-size:0.3rem;font-weight: 600;">批量选项：</span>
            <el-form-item label="数据通道:">
              <el-select v-model="addForm.data_channel" class="inpu_3"
                @change="changeDataChannel(addForm.data_channel,'changeChannel')">
                <el-option v-for="item in dataChannels" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item class="equipArg" label="DB块号:"
              v-if="addForm.data_channel=='D' && addForm.slave_protocol.indexOf('_fx_')<0">
              <el-input class="inpu_5" v-model="addForm.boxNum" placeholder="" @input="changeBoxNum(addForm.boxNum)">
              </el-input>
            </el-form-item>
            <el-form-item label="起始地址:">
              <el-input class="inpu_5" v-model="addForm.first_key" @input="changeFirstKey(addForm.first_key)"
                placeholder=""></el-input>
            </el-form-item>
            <el-form-item label="数值类型:">
              <el-select v-model="addForm.value_type" class="inpu_3" @change="changeValueType(addForm.value_type)"
                style="width:3rem;">
                <el-option v-for="item in valueTypes" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="数量:">
              <el-input class="inpu_5" v-model="addForm.number" placeholder="">
              </el-input>
            </el-form-item>
          </div>
          <div v-if="addForm.slave_protocol.indexOf('645')>=0 && addForm.is_virtual==0" class="slaveInfo_3"
            style="height:1.8rem;padding-top:0.1rem;display:inline-block;">
            <!-- <span style="font-size:0.3rem;font-weight: 600;">批量选项：</span> -->
            <el-form-item label="标识DI3:" v-if="addForm.slave_protocol.indexOf('2007')>=0">
              <el-input class="inpu_5" v-model="addForm.sign_3" type="text" placeholder="标识DI3"
                @input="createT645Key()"></el-input>
            </el-form-item>
            <el-form-item label="标识DI2:" v-if="addForm.slave_protocol.indexOf('2007')>=0">
              <el-input class="inpu_5" v-model="addForm.sign_2" type="text" placeholder="标识DI2"
                @input="createT645Key()"></el-input>
            </el-form-item>
            <el-form-item label="标识DI1:">
              <el-input class="inpu_5" v-model="addForm.sign_1" type="text" placeholder="标识DI1"
                @input="createT645Key()"></el-input>
            </el-form-item>
            <el-form-item label="标识DI0:">
              <el-input class="inpu_5" v-model="addForm.sign_0" type="text" placeholder="标识DI0"
                @input="createT645Key()"></el-input>
            </el-form-item>
            <el-form-item class="equipArg" label="数值类型:">
              <el-select v-model="addForm.value_type" placeholder="数值类型:" class="inpu_3" style="width:3rem;">
                <el-option v-for="item in valueTypes_T645" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-form-item><br>
            <el-form-item label="" style="margin-top:-0.3rem;">
              <span class="tip" style="width:100%;color:red;margin-top:0;">注:1.标识必须是00至FF的16进制写法;2.当前协议不支持批量添加;</span>
            </el-form-item>

          </div>
          <!-- <el-form-item class="arg" style="width:100%;" label="数据点参数："> -->
          <div style="font-size:0.3rem;font-weight: 600;width:100%;margin:0.1rem 0;">数据点参数：<span
              style="color:red;font-weight:normal;font-size:0.25rem;">{{addForm.is_virtual==0?'已默认部分参数；名称和地址必须唯一,名称用于显示和选择,建议与实际语义化；地址用于数据传输；排序为显示顺序(自动追加)':'已默认部分参数；名称必须唯一,用于显示和选择,建议与实际语义化；'}}</span>
            <!-- <el-button size="mini" v-if="addForm.is_virtual==1 && !drawerShow" style="margin-left:0.3rem;" @click="varStringHelp('add')">打开公式生成器</el-button> -->
            <!-- <el-button size="mini" v-if="addForm.is_virtual==1 && drawerShow" style="margin-left:0.3rem;"  @click="varStringHelp('add')">关闭公式生成器</el-button> -->
            <el-button v-if="addForm.is_virtual==1" size="mini" style="margin-left:0.3rem;"
              @click="formulaInfoVisible=true">计算公式说明</el-button>
          </div>
          <!-- </el-form-item> -->
          <!-- <el-form-item label="名称:" class="formline_2" style="margin:0.1rem 0;width:100%;" :label-width="formLabelWidth2">
						<el-input class="inpu_3 over" v-model="addForm.sensor_name" placeholder="数据点名称"></el-input><span class="tip" style="display:inline-block;width:auto;vertical-align: middle;margin-left:0.2rem;">名称和地址必须唯一,名称用于显示和选择,地址用于数据传输,排序决定显示顺序</span>
					</el-form-item> -->
          <el-form-item label="名称:" class="formline_2" :label-width="formLabelWidth">
            <el-input class="inpu_3 over" v-model="addForm.sensor_name" @change="changeSensorName(addForm.sensor_name)"
              title="不要超过15个字" placeholder="不要超过15个字"></el-input>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual==0" label="地址:" class="formline_2"
            :class="addForm.is_virtual!=1?'equipArg':''" :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="addForm.data_key" type="text" disabled placeholder="数据地址"></el-input>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual==0" label="键名:" class="formline_2 equipArg"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="addForm.value_key" type="text" placeholder="数据键名"></el-input>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual!=1" class="formline_2 equipArg" label="倍数:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="addForm.magnification" placeholder="输入倍数"
              @input="changeMinMax(addForm.value_type,addForm.magnification,addForm.threshold)"></el-input>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual!=1" class="formline_2 equipArg" label="偏置:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="addForm.value_offset" placeholder="输入偏置"></el-input>
          </el-form-item>
          <el-form-item class="formline_2" :class="addForm.is_virtual!=1?'equipArg':''" label="小数位:"
            :label-width="formLabelWidth">
            <el-select :disabled="addForm.show_type>2" v-model="addForm.decimals" class="inpu_3"
              @change="changeAddDecimal(addForm.decimals,addForm.magnification)">
              <el-option v-for="item in points" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual!=1" class="formline_2 equipArg" label="阈值:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="addForm.threshold" placeholder="输入阈值"
              @input="changeMinMax(addForm.value_type,addForm.magnification,addForm.threshold)"></el-input>
          </el-form-item>
          <!-- <el-form-item v-show="deviceData.app_scene==2"  class="formline_2 equipArg" label="低限:" :label-width="formLabelWidth">
						<el-input class="inpu_3" v-model="addForm.min_value" placeholder="输入低限值"></el-input>
					</el-form-item>
					<el-form-item v-show="deviceData.app_scene==2"  class="formline_2 equipArg" label="高限:" :label-width="formLabelWidth">
						<el-input class="inpu_3" v-model="addForm.max_value" placeholder="输入高限值"></el-input>
					</el-form-item>
					<el-form-item v-show="deviceData.app_scene==2"  class="formline_2 equipArg" label="标记:" :label-width="formLabelWidth">
						<el-select v-model="addForm.mark" class="inpu_3" >
							<el-option v-for="item in waterMarks" :key="item.value" :value="item.value" :label="item.label">
							</el-option>
						</el-select>
					</el-form-item> -->
          <el-form-item v-show="deviceData.app_scene==2" class="formline_2 equipArg" label="低限:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="addForm.min_value" placeholder="输入低限值"></el-input>
          </el-form-item>
          <el-form-item v-show="deviceData.app_scene==2" class="formline_2 equipArg" label="高限:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="addForm.max_value" placeholder="输入高限值"></el-input>
          </el-form-item>
          <el-form-item v-show="deviceData.app_scene==2" class="formline_2 equipArg" label="标记:"
            :label-width="formLabelWidth">
            <el-select v-model="addForm.mark" class="inpu_3">
              <el-option v-for="item in waterMarks" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item  class="formline_2" :class="addForm.is_virtual!=1?'equipArg':''" label="数据属性:"
            :label-width="formLabelWidth">
            <el-select v-if="deviceData.version==3" v-model="addForm.report_type" class="inpu_3">
              <el-option v-for="item in reportTypes" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
            <el-select v-if="deviceData.version==4" v-model="addForm.report_type" class="inpu_3" @change="changeReportType(addForm.report_type,'add')">
              <el-option v-for="item in reportTypes_54" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual!=1" class="formline_2" label="读写/显示:" :label-width="formLabelWidth">
            <el-select v-model="addForm.show_type" placeholder="读写/显示:" class="inpu_3"
              @change="changeAddType(addForm.show_type)" :disabled="addForm.report_type==3">
              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_2" label="单位:" :label-width="formLabelWidth">
            <el-input :disabled="addForm.show_type>2" class="inpu_3" v-model="addForm.unit"
              :placeholder="addForm.show_type<3?'单位，可为空':'非数值，禁用'"></el-input>
          </el-form-item>
          <el-form-item class="formline_2" label="数据存储:" :label-width="formLabelWidth">
            <el-select v-model="addForm.save_type" :disabled="addForm.report_type==3 || addForm.report_type==4" placeholder="是否存储" class="inpu_3">
              <el-option v-for="item in saves" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual==1" class="formline_2" label="所属分组:" :label-width="formLabelWidth">
            <el-select v-model="addForm.sgroup_id" class="inpu_3">
              <el-option v-for="item in groups" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item  v-if="addForm.is_virtual==1" class="formline_2" style="width:100%;" label="计算公式:" :label-width="formLabelWidth">
						<el-input  class="inpu_3"  style="width:18.25rem;"  :title="addForm.formula" v-model="addForm.formula"   @dblclick.native="fillString('add')"
							placeholder="双击自动填入(或替换)右侧计算公式"></el-input>
					</el-form-item> -->
          <!-- <el-form-item  v-if="addForm.is_virtual==1" class="formline_2" style="width:100%;" label="计算公式:" :label-width="formLabelWidth">
						<el-input  class="inpu_3"  style="width:18.25rem;" type="textarea" :autosize="{minRows:1.5,maxRows:10}" resize="none" :title="addForm.formula" v-model="addForm.formula"
							placeholder="先点击变量,后加入运算符"></el-input>
					</el-form-item> -->
          <el-form-item v-if="addForm.is_virtual==0" class="formline_2" label="所属分组:" :label-width="formLabelWidth">
            <el-select v-model="addForm.sgroup_id" class="inpu_3">
              <el-option v-for="item in groups" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual==0" class="formline_2" label="排序:" :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="addForm.list_order" placeholder="排序"></el-input>
          </el-form-item>
          <el-form-item v-if="addForm.is_virtual==0" class="formline_2"
            style="height:1rem;line-height:1rem;margin-top:0.2rem;" label="图标:" :label-width="formLabelWidth">
            <!-- <el-popover placement="top" width="240"
							style="height:3.5rem;line-height:1rem;vertical-align: middle;margin-top:-0.5rem;margin-left:0.1rem;"
							trigger="manual" v-model="addForm.visible"> -->
            <el-popover placement="top" width="240"
              style="display:line-block;height:3.5rem;line-height:1rem;vertical-align: middle;margin-top:-0.5rem;margin-left:0.1rem;"
              trigger="click">
              <img v-for="(i) in 18" :key="i" :src="baseurl+'static/images/icon/icon'+i+'.png'" class="thumb"
                style="margin-left:0.27rem;margin-bottom: 0.2rem;" :id="i" @click="chooseIcon_1" />
              <!-- <el-button slot="reference" class="iconbtn" @click="addForm.visible = true"><img
									:src="baseurl+addForm.icon" class="thumb" /></el-button> -->
              <el-button slot="reference" class="iconbtn">
                <img :src="baseurl+addForm.icon" class="thumb" />
              </el-button>
            </el-popover>
            <span style="float:right;width:auto;vertical-align: middle;margin:0.1rem 0.2rem;">点击图标切换</span>
          </el-form-item>
          <!-- <el-form-item  v-if="addForm.is_virtual==1" class="formline_2" style="width:100%;" label="计算公式:" :label-width="formLabelWidth">
						<el-input  class="inpu_3"  style="width:18.25rem;"  :title="addForm.formula" v-model="addForm.formula"   @dblclick.native="fillString('add')"
							placeholder="双击自动填入(或替换)右侧计算公式"></el-input>
					</el-form-item> -->
          <el-form-item v-if="addForm.is_virtual==1" class="formline_2" style="width:100%;" label="计算公式:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" style="width:18.25rem!important;" type="textarea"
              :autosize="{minRows:1.5,maxRows:4}" resize="none" :title="addForm.formula" v-model="addForm.formula"
              placeholder="先点击变量,后加入运算符"></el-input>
          </el-form-item>
        </el-form>
        <div v-if="addForm.is_virtual==0" style="text-align: right;margin-top:0.2rem;">
          <el-button size="small" @click="cancelAdd">取 消</el-button>
          <el-button type="primary" size="small" @click="addHappen(addForm.is_virtual)">确 定</el-button>
        </div>
        <div v-else style="text-align: right;margin-top:1.2rem;">
          <el-button size="small" @click="cancelAdd">取 消</el-button>
          <el-button type="primary" size="small" @click="addHappen(addForm.is_virtual)">确 定</el-button>
        </div>
        <!-- <FormulaCreater
				   style="width:18%;"
				   :drawerShow="drawerShow"
				   :sensorTree="sensorTree"
				></FormulaCreater> -->
        <div class="rightBox" v-if="addForm.is_virtual==1" :class="!drawerShow?'zeroWidth':''">
          <h4>变量列表</h4>
          <div class="sensorTree">
            <el-input style="width:98%;display:block;margin:0 auto;" placeholder="输入关键字进行过滤" v-model="filterText">
            </el-input>
            <el-tree style="margin-top:0.1rem;" class="filter-tree" :data="sensorTree" @node-click="getSensorString"
              default-expand-all :indent="30" :filter-node-method="filterNode"  ref="tree">
            </el-tree>
          </div>
          <!-- <div class="stringBox">
						<div>
							<span>计算公式：<span>先点击数据点，后插入运算符</span></span>
							<el-button size="mini" v-if="sensorString" @click="reSetString" style="float: right;vertical-align: middle;">清空</el-button>
						</div>
						<el-input  type="textarea" ref="sensorString" v-model="sensorString" :autosize="{minRows:7,maxRows:20}"></el-input>
					</div> -->
        </div>
      </el-dialog>
      <el-dialog :visible="dialogFormVisible_2" v-el-dialog-drag v-el-dialog-drag-width
        :width="screenWidth>1600?'60%':'70%'" append-to-body class="dial" :show-close="close" top="60px">
        <div class="toptit">
          <span>{{editForm.is_virtual==1?'编辑虚拟数据点':'编辑数据点'}}</span>
          <span style="float:right;cursor: pointer;" @click="cancelUpdate">关闭</span>
        </div>
        <el-form :model="editForm" style="text-align:left;" inline>
          <div class="slaveInfo_3">
            <span style="font-size:0.3rem;font-weight: 600;">从属信息：</span>
            <span>当前端口：{{channelToUpper(slaveInfo.channel.channel_type)}}</span>
            <span style="margin-left:0.4rem;">当前子设备：<span style="color:red;">{{slaveInfo.slave_name}}</span></span>
            <span v-if="editForm.is_virtual==0"
              style="margin-left:0.4rem;">当前协议：{{protocolToUpper(slaveInfo.slave_protocol)}}</span>
          </div>
          <div class="slaveInfo_3" style="border:none;">
            <span
              style="font-size:0.25rem;color:red;">注：{{editForm.is_virtual==0?'蓝色属性与硬件模块有关,修改后必须下发才能生效,只修改黑色属性无需下发；名称和地址必须唯一；':'修改虚拟数据点无需下发；名称必须唯一；'}}</span>
            <!-- <el-button size="mini" v-if="editForm.is_virtual==1 && !drawerShow" style="margin-left:0.3rem;" @click="varStringHelp('edit')">打开公式生成器</el-button> -->
            <!-- <el-button size="mini" v-if="editForm.is_virtual==1 && drawerShow" style="margin-left:0.3rem;"  @click="varStringHelp('edit')">关闭公式生成器</el-button> -->
            <el-button v-if="editForm.is_virtual==1" size="mini" style="margin-left:0.3rem;"
              @click="formulaInfoVisible=true">计算公式说明</el-button>
          </div>
          <!-- <el-form-item label="" style="width:100%;height:0.4rem;line-height:0.4rem;" >
						<span class="tip" style="display:inline-block;width:auto;vertical-align: middle;margin-top:0.1rem;"></span>
					</el-form-item> -->
          <el-form-item label="名称:" class="formline_2" :label-width="formLabelWidth">
            <el-input class="inpu_3 over" style="vertical-align: middle;" v-model="editForm.sensor_name"
              title="不要超过15个字" placeholder="不要超过15个字"></el-input>
          </el-form-item>
          <el-form-item v-if="editForm.is_virtual==0" label="地址:" class="formline_2 equipArg"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.data_key" placeholder="数据地址" disabled></el-input>
          </el-form-item>
          <el-form-item v-if="editForm.is_virtual==0" label="键名:" class="formline_2 equipArg"
            style="margin-top:-0.1rem;" :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.value_key" placeholder="数据键名"></el-input>
          </el-form-item>
          <el-form-item v-if="editForm.is_virtual==0" label="数值类型:" class="formline_2 equipArg"
            :label-width="formLabelWidth">
            <el-select v-model="editForm.value_type" placeholder="数值类型:" class="inpu_3" disabled>
              <el-option v-for="item in valueTypes" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_2 equipArg" v-if="editForm.is_virtual!=1" label="倍数:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.magnification" placeholder="输入倍数"
              @input="changeEditMinMax(editForm.value_type,editForm.magnification,editForm.threshold)"></el-input>
          </el-form-item>
          <el-form-item class="formline_2 equipArg" v-if="editForm.is_virtual!=1" label="偏置:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.value_offset" placeholder="输入偏置"></el-input>
          </el-form-item>
          <el-form-item class="formline_2 equipArg" v-if="editForm.is_virtual!=1" label="阈值:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.threshold" placeholder="输入阈值"
              @input="changeEditMinMax(editForm.value_type,editForm.magnification,editForm.threshold)"></el-input>
          </el-form-item>
          <el-form-item class="formline_2" :class="editForm.is_virtual!=1?'equipArg':''" label="小数位:"
            :label-width="formLabelWidth">
            <el-select :disabled="editForm.show_type>2" v-model="editForm.decimals"
              @change="changeEditDecimal(editForm.decimals,editForm.magnification)"
              :placeholder="editForm.show_type>2?'非数值,禁用':''" class="inpu_3">
              <el-option v-for="item in points" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item v-show="deviceData.app_scene==2"  class="formline_2 equipArg" label="低限:" :label-width="formLabelWidth">
						<el-input class="inpu_3" v-model="editForm.min_value" placeholder="输入低限值"></el-input>
					</el-form-item>
					<el-form-item v-show="deviceData.app_scene==2"  class="formline_2 equipArg" label="高限:" :label-width="formLabelWidth">
						<el-input class="inpu_3" v-model="editForm.max_value" placeholder="输入高限值"></el-input>
					</el-form-item>
					<el-form-item v-show="deviceData.app_scene==2"  class="formline_2 equipArg" label="标记:" :label-width="formLabelWidth">
						<el-select v-model="editForm.mark" class="inpu_3" >
							<el-option v-for="item in waterMarks" :key="item.value" :value="item.value" :label="item.label">
							</el-option>
						</el-select>
					</el-form-item> -->
          <el-form-item v-show="deviceData.app_scene==2" class="formline_2 equipArg" label="低限:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.min_value" placeholder="输入低限值"></el-input>
          </el-form-item>
          <el-form-item v-show="deviceData.app_scene==2" class="formline_2 equipArg" label="高限:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.max_value" placeholder="输入高限值"></el-input>
          </el-form-item>
          <el-form-item v-show="deviceData.app_scene==2" class="formline_2 equipArg" label="标记:"
            :label-width="formLabelWidth">
            <el-select v-model="editForm.mark" class="inpu_3">
              <el-option v-for="item in waterMarks" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_2" :class="editForm.is_virtual!=1?'equipArg':''" label="数据属性:"
            :label-width="formLabelWidth">
            <el-select v-if="deviceData.version==3" v-model="editForm.report_type" class="inpu_3">
              <el-option v-for="item in reportTypes" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
            <el-select v-if="deviceData.version==4" v-model="editForm.report_type" class="inpu_3" @change="changeReportType(editForm.report_type,'edit')">
              <el-option v-for="item in reportTypes_54" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_2" v-if="editForm.is_virtual!=1" label="读写/显示:" :label-width="formLabelWidth">
            <el-select v-model="editForm.show_type" placeholder="读写/显示:" class="inpu_3"
              @change="changeEditType(editForm.show_type)" :disabled="editForm.report_type==3">
              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_2" label="数据存储:" :label-width="formLabelWidth">
            <el-select v-model="editForm.save_type" :disabled="editForm.report_type==3 || editForm.report_type==4" placeholder="是否存储" class="inpu_3">
              <el-option v-for="item in saves" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>

          <el-form-item class="formline_2" label="单位:" :label-width="formLabelWidth">
            <el-input :disabled="editForm.show_type>2" class="inpu_3" v-model="editForm.unit"
              :placeholder="editForm.show_type>2?'非数值,禁用':'单位,可无'"></el-input>
          </el-form-item>
          <el-form-item class="formline_2" label="所属分组:" :label-width="formLabelWidth">
            <el-select v-model="editForm.sgroup_id" class="inpu_3">
              <el-option v-for="item in groups" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-if="editForm.is_virtual==1" class="formline_2" style="width:100%;" label="计算公式:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" style="width:18.25rem!important;" :title="editForm.formula"
              v-model="editForm.formula" type="textarea" :autosize="{minRows:1.5,maxRows:4}" resize="none"
              placeholder="双击自动填入(或替换为)右侧计算公式"></el-input>
          </el-form-item>
          <!-- <el-form-item  v-if="editForm.is_virtual==1" class="formline_2" style="width:100%;" label="计算公式:" :label-width="formLabelWidth">
						<el-input  class="inpu_3" style="width:18.25rem;" type="textarea" :autosize="{minRows:1.5,maxRows:4}" resize="none"  :title="editForm.formula" v-model="editForm.formula"
							placeholder="先点击变量,后插入运算符"></el-input>
					</el-form-item> -->
          <el-form-item v-if="editForm.is_virtual==0" class="formline_2" style="margin-top:0.1rem;" label="排序:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.list_order" placeholder="排序"></el-input>
          </el-form-item>
          <el-form-item v-if="editForm.is_virtual==0" class="formline_2"
            style="height:1rem;line-height:1rem;margin-top:0.1rem;" label="图标:" :label-width="formLabelWidth">
            <el-popover placement="top" width="240"
              style="height:3.5rem;line-height:1rem;vertical-align: middle;margin-top:-0.5rem;margin-left:0.1rem;"
              trigger="click">
              <img v-for="(i) in 18" :key="i" :src="baseurl+'static/images/icon/icon'+i+'.png'" class="thumb"
                style="margin-left:0.27rem;margin-bottom: 0.2rem;" :id="i" @click="chooseIcon_2" />
              <el-button slot="reference" class="iconbtn"><img :src="baseurl+editForm.icon" class="thumb" /></el-button>
            </el-popover>
            <span style="float:right;width:auto;vertical-align: middle;margin:0.1rem 0.2rem;">点击图标切换</span>
          </el-form-item>
        </el-form>
        <div v-if="editForm.is_virtual==0" style="text-align: right;margin-top:0.4rem;">
          <el-button size="small" @click="cancelUpdate">取 消</el-button>
          <el-button type="primary" size="small" @click="updateHappen">确 定</el-button>
        </div>
        <div v-else style="text-align: right;margin-top:1.2rem;">
          <el-button size="small" @click="cancelUpdate">取 消</el-button>
          <el-button type="primary" size="small" @click="updateHappen">确 定</el-button>
        </div>
        <!-- <FormulaCreater
				   style="width:18%;"
				   :drawerShow="drawerShow"
				   :sensorTree="sensorTree"
				></FormulaCreater> -->
        <div class="rightBox" v-if="editForm.is_virtual==1" :class="!drawerShow?'zeroWidth':''">
          <h4>变量列表</h4>
          <div class="sensorTree">
            <el-input style="width:98%;display:block;margin:0 auto;" placeholder="输入关键字进行过滤" v-model="filterText">
            </el-input>
            <el-tree style="margin-top:0.1rem;" class="filter-tree" :data="sensorTree" @node-click="getSensorString"
              default-expand-all :indent="30" :filter-node-method="filterNode" ref="tree">
            </el-tree>
          </div>
          <!-- <div class="stringBox">
						<div>
							<span>计算公式：<span>先点击数据点，后插入运算符</span></span>
							<el-button size="mini" v-if="sensorString" @click="reSetString" style="float: right;vertical-align: middle;">清空</el-button>
						</div>
						<el-input  type="textarea" ref="sensorString" v-model="sensorString" :autosize="{minRows:7,maxRows:20}"></el-input>
					</div> -->
        </div>
      </el-dialog>
      <el-dialog :visible="oneUpdateVisible" v-el-dialog-drag v-el-dialog-drag-width
        :width="screenWidth>1600?'25%':'35%'" append-to-body class="dial" :show-close="close" top="200px">
        <div class="toptit">
          <!-- <span>{{whatName}} | 修改{{whatText}}</span> -->
          <span>{{whatName}} | 属性修改</span>
          <span style="float:right;cursor: pointer;" @click="cancelOneUpdate">关闭</span>
        </div>
        <el-form :model="editForm" style="text-align:left;margin-top:0.3rem;" block>
          <el-form-item v-show="whichOne=='sensor_name'" label="名称:" :label-width="formLabelWidth">
            <el-input class="inpu_3 over" style="vertical-align:top;" v-model="editForm.sensor_name"
              placeholder="数据点名称"></el-input>
          </el-form-item>
          <el-form-item v-show="whichOne=='value_key'" class="equipArg" label="键名:" :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.value_key" style="vertical-align:top;"
              placeholder="输入键名"></el-input>
          </el-form-item>
          <el-form-item v-show="whichOne=='magnification'" class="equipArg" label="倍数:" :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.magnification" style="vertical-align:top;" placeholder="输入倍数"
              @input="changeEditMinMax(editForm.value_type,editForm.magnification,editForm.threshold)"></el-input>
          </el-form-item>
          <el-form-item v-show="whichOne=='value_offset'" class="equipArg" label="偏置:" :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.value_offset" style="vertical-align:top;"
              placeholder="输入偏置"></el-input>
          </el-form-item>
          <el-form-item v-show="whichOne=='threshold'" class="equipArg" label="阈值:" :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.threshold" style="vertical-align:top;" placeholder="输入阈值"
              @input="changeEditMinMax(editForm.value_type,editForm.magnification,editForm.threshold)"></el-input>
          </el-form-item>
          <el-form-item v-show="whichOne=='decimals'" :class="editForm.is_virtual==0?'equipArg':''" label="小数位:"
            :label-width="formLabelWidth">
            <el-select :disabled="editForm.show_type>2" v-model="editForm.decimals"
              @change="changeEditDecimal(editForm.decimals,editForm.magnification)"
              :placeholder="editForm.show_type>2?'非数值,禁用':''" class="inpu_3" style="vertical-align:top;">
              <el-option v-for="item in points" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="deviceData.app_scene==2 && whichOne=='min_value'" class="equipArg" label="低限:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.min_value" style="vertical-align:top;"
              placeholder="输入低限值"></el-input>
          </el-form-item>
          <el-form-item v-show="deviceData.app_scene==2 && whichOne=='max_value'" class="equipArg" label="高限:"
            :label-width="formLabelWidth">
            <el-input class="inpu_3" v-model="editForm.max_value" style="vertical-align:top;"
              placeholder="输入高限值"></el-input>
          </el-form-item>
          <el-form-item v-show="deviceData.app_scene==2 && whichOne=='mark'" class="equipArg" label="标记:"
            :label-width="formLabelWidth">
            <el-select v-model="editForm.mark" class="inpu_3" style="vertical-align:top;">
              <el-option v-for="item in waterMarks" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="whichOne=='report_type'" :class="editForm.is_virtual==0?'equipArg':''" label="数据属性:"
            :label-width="formLabelWidth">
            <el-select v-if="deviceData.version==3" v-model="editForm.report_type" class="inpu_3" style="vertical-align:top;">
              <el-option v-for="item in reportTypes" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
            <el-select v-if="deviceData.version==4" v-model="editForm.report_type" class="inpu_3" style="vertical-align:top;" @change="changeReportType(editForm.report_type,'edit')">
              <el-option v-for="item in reportTypes_54" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="whichOne=='show_type'" label="读写/显示:" :label-width="formLabelWidth">
            <el-select v-model="editForm.show_type" placeholder="读写/显示:" class="inpu_3" style="vertical-align:top;"
              @change="changeEditType(editForm.show_type)" :disabled="editForm.report_type==3">
              <el-option v-for="item in updateManyOptions" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="whichOne=='save_type'" label="数据存储:" :label-width="formLabelWidth">
            <el-select v-model="editForm.save_type" :disabled="editForm.report_type==3 || editForm.report_type==4" placeholder="是否存储" class="inpu_3" style="vertical-align:top;">
              <el-option v-for="item in saves" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="whichOne=='unit'" label="单位:" :label-width="formLabelWidth">
            <el-input :disabled="editForm.show_type>2" class="inpu_3" style="vertical-align:top;"
              v-model="editForm.unit" :placeholder="editForm.show_type>2?'非数值,禁用':'单位,可无'"></el-input>
          </el-form-item>
          <el-form-item v-show="whichOne=='sgroup_name'" label="所属分组:" :label-width="formLabelWidth">
            <el-select v-model="editForm.sgroup_id" class="inpu_3" style="vertical-align:top;">
              <el-option v-for="item in groups" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item v-show="whichOne=='list_order'" label="排序:" :label-width="formLabelWidth">
            <el-input class="inpu_3" style="vertical-align:top;" v-model="editForm.list_order"
              placeholder="排序"></el-input>
          </el-form-item>
          <el-form-item label="" :label-width="formLabelWidth" style="margin-top:-0.2rem;margin-left:-3px;"
            v-show="['magnification','value_offset','decimals','threshold','report_type','min_value','max_value','mark'].indexOf(whichOne)>=0 && editForm.is_virtual==0">
            <p style="font-size:0.3rem;color:red;">注:修改此属性须下发才能生效</p>
          </el-form-item>
        </el-form>
        <!-- <div>
					<p style="font-size:0.3rem;color:red;">注:修改此属性须下发才能生效</p>
				</div> -->
        <div style="text-align: right;margin-top:0.4rem;">
          <el-button size="small" @click="cancelOneUpdate">取 消</el-button>
          <el-button type="primary" size="small" @click="updateHappen">确 定</el-button>
        </div>
      </el-dialog>
      <!-- <el-dialog :visible="manyUpdateVisible" :width="screenWidth>1600?'55%':'65%'" append-to-body
				:show-close="close" :close-on-click-modal="false" top="60px"> -->
      <el-dialog :visible="manyUpdateVisible" :width="screenWidth>1600?'35%':'45%'" append-to-body :show-close="close"
        :close-on-click-modal="false" top="200px">
        <div class="toptit">
          <span>批量修改数据点</span>
          <span style="float:right;cursor: pointer;" @click="cancelUpdateMany">关闭</span>
        </div>
        <div class="tip_1"
          style="font-size:0.25rem;color:red;height:0.8rem;line-height:0.4rem;width:100%;margin:0.2rem 0 0.2rem 1.1rem;">
          注：1.这里只列出可以批量修改的属性，其他属性需要单独修改!<br>　　2.修改蓝色属性须下发生效，只修改黑色属性无需下发！</div>
        <el-form :model="editManyForm" style="text-align:left;" class="manyForm" block>
          <!-- <div class="slaveInfo_3">
						<span style="font-size:0.3rem;font-weight: 600;">从属信息：</span>
						<span>当前端口：{{channelToUpper(slaveInfo.channel.channel_type)}}</span>
						<span style="margin-left:0.4rem;">当前子设备：<span
								style="color:red;">{{slaveInfo.slave_name}}</span></span>
						<span style="margin-left:0.4rem;">当前协议：{{protocolToUpper(slaveInfo.slave_protocol)}}</span>
					</div> -->
          <el-form-item class="formline_2" style="width:100%;" label="选择要修改的属性:" :label-width="formLabelWidth2">
            <el-select v-model="editManyForm.edit_which" placeholder="要修改的属性:" class="inpu_3">
              <el-option v-for="item in whiches" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>

          <el-form-item class="formline_2 equipArg" v-show="editManyForm.edit_which=='magnification'" label="倍数:"
            :label-width="formLabelWidth2">
            <el-input class="inpu_3" v-model="editManyForm.magnification" placeholder="输入倍数"></el-input>
          </el-form-item>
          <el-form-item class="formline_2 equipArg" v-show="editManyForm.edit_which=='value_offset'" label="偏置:"
            :label-width="formLabelWidth2">
            <el-input class="inpu_3" v-model="editManyForm.value_offset" placeholder="输入偏置"></el-input>
          </el-form-item>
          <el-form-item class="formline_2 equipArg" v-show="editManyForm.edit_which=='threshold'" label="阈值:"
            :label-width="formLabelWidth2">
            <el-input class="inpu_3" v-model="editManyForm.threshold" placeholder="输入阈值"></el-input>
          </el-form-item>
          <el-form-item class="formline_2 equipArg" v-show="editManyForm.edit_which=='decimals'" label="小数位:"
            :label-width="formLabelWidth2">
            <el-select :disabled="editManyForm.show_type>2" v-model="editManyForm.decimals"
              :placeholder="editManyForm.show_type>2?'非数值,禁用':''" class="inpu_3">
              <el-option v-for="item in points" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
            <div class="tip_1" style="font-size:0.25rem;color:red;line-height:0.4rem;width:4rem;margin-top:0.2rem;">
              对于显示方式为开关/状态/报警的数据点,此项固定为0,修改无效</div>
          </el-form-item>
          <el-form-item class="formline_2 equipArg" v-show="editManyForm.edit_which=='report_type'" label="数据属性:"
            :label-width="formLabelWidth2">
            <el-select v-if="deviceData.version==3" v-model="editManyForm.report_type" class="inpu_3">
              <el-option v-for="item in reportTypes" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
            <el-select v-if="deviceData.version==4" v-model="editManyForm.report_type" class="inpu_3">
              <el-option v-for="item in reportTypes_54" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_2" v-show="editManyForm.edit_which=='show_type'" label="读写/显示:"
            :label-width="formLabelWidth2">
            <el-select v-model="editManyForm.show_type" placeholder="读写/显示:" class="inpu_3">
              <el-option v-for="item in updateManyOptions" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_2" v-show="editManyForm.edit_which=='save_type'" label="数据存储:"
            :label-width="formLabelWidth2">
            <el-select v-model="editManyForm.save_type" placeholder="是否存储" class="inpu_3">
              <el-option v-for="item in saves" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_2" v-show="editManyForm.edit_which=='unit'" label="单位:"
            :label-width="formLabelWidth2">
            <el-input :disabled="editManyForm.show_type>2" class="inpu_3" v-model="editManyForm.unit"
              :placeholder="editManyForm.show_type>2?'非数值,禁用':'单位,可无'"></el-input>
            <div class="tip_1" style="font-size:0.25rem;color:red;line-height:0.4rem;width:4rem;margin-top:0.2rem;">
              对于显示方式为开关/状态/报警的数据点,此项固定为空,修改无效</div>
          </el-form-item>
          <el-form-item class="formline_2" v-show="editManyForm.edit_which=='sgroup_id'" label="所属分组:"
            :label-width="formLabelWidth2">
            <el-select v-model="editManyForm.sgroup_id" class="inpu_3">
              <el-option v-for="item in groups" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>


          <!-- <el-form-item class="formline_2" style="height:1rem;line-height:1rem;margin-top:0.2rem;" label="图标:"
						:label-width="formLabelWidth2">
						<el-popover placement="top" width="240"
							style="height:3.5rem;line-height:1rem;vertical-align: middle;margin-top:-0.5rem;margin-left:0.1rem;"
							trigger="click">
							<img v-for="(i) in 18" :key="i" :src="baseurl+'static/images/icon/icon'+i+'.png'"
								class="thumb" style="margin-left:0.27rem;margin-bottom: 0.2rem;" :id="i"
								@click="chooseIcon_2" />
							<el-button slot="reference" class="iconbtn"><img :src="baseurl+editForm.icon"
									class="thumb" /></el-button>
						</el-popover>
						<span style="float:right;width:auto;vertical-align: middle;margin:0.1rem 0.2rem;">点击图标切换</span>
					</el-form-item> -->
        </el-form>
        <div style="text-align: right;margin-top:0.6rem;">
          <el-button size="small" @click="cancelUpdateMany">取 消</el-button>
          <el-button type="primary" size="small" @click="updateManyHappen">确 定</el-button>
        </div>
      </el-dialog>
      <!-- <el-dialog :visible="dialogFormVisible_3" width="20%" append-to-body :show-close="close" top="240px">
				<div class="toptit">
					<span>复制{{copyitem.sensor_name}}</span>
					<span style="float:right;cursor: pointer;" @click="dialogFormVisible_3=false">关闭</span>
				</div>
				<el-form :model="copyitem" style="text-align:left;" block>
					<el-form-item label="数　　量:">
						<el-input class="inpu" style="width:2rem;" v-model="copyForm.num" placeholder="请输入数量">
						</el-input><br>
						<span style="color:red;">注：单次最低1个，最高20个</span>
					</el-form-item>
				</el-form>
				<div style="text-align: right;">
					<el-button type="success" size="small" @click="sureCopy">确 定</el-button>
					<el-button type="primary" size="small" @click="cancelCopy">取 消</el-button>
				</div>
			</el-dialog> -->
      <el-dialog :visible="dialogFormVisible_4" width="30%" append-to-body :show-close="close">
        <div class="toptit">
          <span>导出为数据点模板</span>
          <span style="float:right;cursor: pointer;" @click="dialogFormVisible_4=false">关闭</span>
        </div>
        <el-form :model="copyTem" style="text-align:left;" inline>
          <el-form-item label="模板名称:">
            <el-input class="inpu" style="display:block;" v-model.trim="copyTem.template_name"
              placeholder="请输入模板名称,必填"></el-input>
          </el-form-item>
          <el-form-item label="备　　注:">
            <el-input class="inpu" type="textarea" :row="3" style="display:block;" v-model.trim="copyTem.remark"
              placeholder="请输入备注,可选"></el-input>
          </el-form-item>
        </el-form>
        <div style="text-align:right;">
          <el-button type="success" size="small" @click="copyTemplate">确 定</el-button>
          <el-button type="primary" size="small" @click="dialogFormVisible_4=false">取 消</el-button>
        </div>
      </el-dialog>
      <!-- 数据点相关结束 -->
    </div>
    <el-dialog :visible.sync="addFormVisible" width="26%" v-el-dialog-drag v-el-dialog-drag-width append-to-body
      :show-close="close" top="100px" class="dial">
      <div class="toptit">
        <span>添加新端口</span>
        <span style="float:right;cursor: pointer;" @click="addFormVisible = false">关闭</span>
      </div>
      <!-- 将下面内容放到添加对话框中 -->
      <div class="channelHead">
        <span class="choice" style="width:2.1rem;text-align:right;">端口选择:&nbsp;&nbsp;&nbsp;</span>
        <el-select v-model="channelForm.channel_type" placeholder="选择端口" class="slaveInpu_2"
          @change="changeChannel(channelForm.channel_type)">
          <el-option v-for="item in channels" :key='item.value' :value="item.value" :label="item.label">
          </el-option>
        </el-select><br>
        <span v-show="(deviceData.version==4 && channelForm.channel_type.indexOf('ernet')<0 && channelForm.channel_type.indexOf('ocal')<0) || (deviceData.version==3 && channelForm.channel_type.indexOf('ocal')<0)" class="choice"
          style="width:2.1rem;text-align:right;">运行模式:&nbsp;&nbsp;&nbsp;</span>
        <el-select v-show="(deviceData.version==4 && channelForm.channel_type.indexOf('ernet')<0 && channelForm.channel_type.indexOf('ocal')<0) || (deviceData.version==3 && channelForm.channel_type.indexOf('ocal')<0)" v-model="channelForm.channel_mode" placeholder="选择运行模式"
          class="slaveInpu_2">
          <el-option v-for="item in channelModes" :key="item.value" :value="item.value" :label="item.label">
          </el-option>
        </el-select>
      </div>
      <div style="margin-top:0.2rem;">
        <el-form :model="rs485Config" v-if="channelForm.channel_type.indexOf('rs')>=0" style="text-align: left;"
          label-position="right" :block="true">
          <el-form-item class="formline_1" label="波特率:" :label-width="formLabelWidth">
            <el-select v-model="rs485Config.baud_rate" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in baudRates" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>&nbsp;bps
          </el-form-item>
          <el-form-item class="formline_1" label="数据位:" :label-width="formLabelWidth">
            <el-select v-model="rs485Config.data_bits" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in dataBits" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="停止位:" :label-width="formLabelWidth">
            <el-select v-model="rs485Config.stop_bits" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in stopBits" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="校验位:" :label-width="formLabelWidth">
            <el-select v-model="rs485Config.parity" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in parities" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <el-form :model="comConfig" v-if="channelForm.channel_type.indexOf('com')==0" style="text-align: left;"
          label-position="right" :block="true">
          <el-form-item class="formline_1" label="波特率:" :label-width="formLabelWidth">
            <el-select v-model="comConfig.baud_rate" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in baudRates" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>&nbsp;bps
          </el-form-item>
          <el-form-item class="formline_1" label="数据位:" :label-width="formLabelWidth">
            <el-select v-model="comConfig.data_bits" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in dataBits" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="停止位:" :label-width="formLabelWidth">
            <el-select v-model="comConfig.stop_bits" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in stopBits" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="校验位:" :label-width="formLabelWidth">
            <el-select v-model="comConfig.parity" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in parities" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="断帧时间:" :label-width="formLabelWidth">
            <el-select v-model="comConfig.timeout" placeholder="选择断帧时间" class="slaveInpu_2">
              <el-option v-for="item in timeoutOptions" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select> <span v-show="comConfig.timeout!=0">ms</span>
          </el-form-item>
        </el-form>
        <el-form :model="ethernetConfig" v-if="channelForm.channel_type.indexOf('thernet')>=0" style="text-align: left;"
          block>
          <el-form-item class="formline_1" label="自动获取IP:" :label-width="formLabelWidth">
            <el-switch v-model="ethernetConfig.dhcp" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="是" inactive-text="否" :active-value="one" :inactive-value="zero">
            </el-switch>
          </el-form-item>
          <el-form-item class="formline_1" label="网关IP:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="ethernetConfig.local_ip" placeholder="输入网关IP地址"
              :disabled="ethernetConfig.dhcp==1"></el-input>
          </el-form-item>
          <!-- <el-form-item class="formline_1" style="margin-top:-0.2rem;" label="默认网关:" -->
          <el-form-item class="formline_1" label="默认网关:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="ethernetConfig.gateway" placeholder="输入本地默认网关"
              :disabled="ethernetConfig.dhcp==1"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="子网掩码:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="ethernetConfig.subnet_mask" placeholder="输入本地子网掩码"
              :disabled="ethernetConfig.dhcp==1"></el-input>
          </el-form-item>

          <el-form-item class="formline_1" label="DNS:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="ethernetConfig.dns" placeholder="输入dns"
              :disabled="ethernetConfig.dhcp==1"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="DNS2:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="ethernetConfig.dns2" placeholder="输入dns2"
              :disabled="ethernetConfig.dhcp==1"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="NTP:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="ethernetConfig.ntp" placeholder="输入ntp"
              :disabled="ethernetConfig.dhcp==1"></el-input>
          </el-form-item>

         <!-- <el-form-item class="formline_1" label="云盒Port:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="ethernetConfig.local_port" placeholder="输入云盒端口号"
              :disabled="ethernetConfig.dhcp==1"></el-input>
          </el-form-item> -->
        </el-form>
        <el-form :model="loraConfig" v-if="channelForm.channel_type.indexOf('ora')>=0" style="text-align: left;" block>
          <el-form-item label="通讯信道:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="loraConfig.channel" placeholder="输入通讯信道"></el-input>
            <div class="tip_1">取值范围0-83</div>
          </el-form-item>
          <el-form-item label="模块地址:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="loraConfig.address" placeholder="输入模块地址"></el-input>
            <div class="tip_1">取值范围0-65535</div>
          </el-form-item>
          <el-form-item label="空中速率:" :label-width="formLabelWidth">
            <el-select v-model="loraConfig.air_rate" placeholder="选择空中速率" class="slaveInpu_2">
              <el-option v-for="item in speeds" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>&nbsp;bps
          </el-form-item>
          <el-form-item class="formline_1" label="断帧时间:" :label-width="formLabelWidth">
            <el-select v-model="loraConfig.timeout" placeholder="选择断帧时间" class="slaveInpu_2">
              <el-option v-for="item in timeoutOptions" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select> <span v-show="loraConfig.timeout!=0">ms</span>
          </el-form-item>
          <el-form-item class="formline_1" label="数据加密:" :label-width="formLabelWidth">
            <el-radio-group v-model="loraConfig.data_encrypt">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>

          </el-form-item>
          <el-form-item class="formline_1" label="网络ID:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="loraConfig.net_id" placeholder="网络ID"></el-input>
          </el-form-item>

        </el-form>
        <el-form :model="zigbeeConfig" v-if="channelForm.channel_type.indexOf('igbee')>=0" style="text-align: left;"
          block>
          <el-form-item label="通讯信道:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="zigbeeConfig.channel" placeholder="输入通讯信道"></el-input>
            <div class="tip_1">取值范围0-83</div>
          </el-form-item>
          <el-form-item label="PAN ID:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="zigbeeConfig.pan_id" placeholder="输入PAN ID"></el-input>
            <div class="tip_1">取值范围0-65535</div>
          </el-form-item>
          <el-form-item class="formline_1" label="断帧时间:" :label-width="formLabelWidth">
            <el-select v-model="zigbeeConfig.timeout" placeholder="选择断帧时间" class="slaveInpu_2">
              <el-option v-for="item in timeoutOptions" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select> <span v-show="zigbeeConfig.timeout!=0">ms</span>
          </el-form-item>

        </el-form>
        <!-- <el-form :model="localConfig" v-if="channelForm.channel_type.indexOf('ocal')>=0" style="text-align: left;"
          block>
          <el-form-item label="DI数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="localConfig.di_count" placeholder="输入通讯信道"></el-input>
          </el-form-item>
          <el-form-item label="DO数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="localConfig.do_count" placeholder="输入DO数量"></el-input>
          </el-form-item>
          <el-form-item label="AI数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="localConfig.ai_count" placeholder="输入AI数量"></el-input>
          </el-form-item>
          <el-form-item label="AO数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="localConfig.ao_count" placeholder="输入AO数量"></el-input>
          </el-form-item>
          <el-form-item label="温度数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="localConfig.temp_count" placeholder="输入温度数量"></el-input>
          </el-form-item>
          <el-form-item label="PI数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="localConfig.pi_count" placeholder="输入PI数量"></el-input>
          </el-form-item>
        </el-form> -->
      </div>
      <div style="text-align: right;margin-top:0.6rem;">
        <el-button size="small" @click="addFormVisible = false">取 消</el-button>
        <el-button type="primary" size="small" @click="addChannel">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="editFormVisible" width="26%" v-el-dialog-drag v-el-dialog-drag-width id="smallScreen"
      append-to-body :show-close="close" top="100px" class="dial">
      <div class="toptit">
        <span>编辑端口</span>
        <span style="float:right;cursor: pointer;" @click="editFormVisible = false">关闭</span>
      </div>
      <!-- 将下面内容放到添加对话框中 -->
      <div class="channelHead" style="max-height:2.2rem;min-height:1rem;">
        <span class="choice"
          style="width:2.1rem;text-align:right;line-height:0.6rem;">端口名称:&nbsp;&nbsp;</span><span>{{channelToUpper(editChannelForm.channel_type)}}</span><br>
        <span v-show="(deviceData.version==4 && channelForm.channel_type.indexOf('ernet')<0 && channelForm.channel_type.indexOf('ocal')<0) || (deviceData.version==3 && channelForm.channel_type.indexOf('ocal')<0)" class="choice"
          style="width:2.1rem;text-align:right;">运行模式:&nbsp;&nbsp;</span>
        <el-select v-show="(deviceData.version==4 && channelForm.channel_type.indexOf('ernet')<0 && channelForm.channel_type.indexOf('ocal')<0) || (deviceData.version==3 && channelForm.channel_type.indexOf('ocal')<0)" v-model="editChannelForm.channel_mode" placeholder="选择运行模式"
          class="slaveInpu_2">
          <el-option v-for="item in channelModes" :key="item.value" :value="item.value" :label="item.label">
          </el-option>
        </el-select>
      </div>
      <div style="margin-top:0.2rem">
        <el-form :model="editChannelForm.rs485Config" v-if="editChannelForm.channel_type.indexOf('rs')>=0"
          style="text-align: left;" label-position="right" block>
          <el-form-item class="formline_1" label="波特率:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.rs485Config.baud_rate" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in baudRates" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="数据位:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.rs485Config.data_bits" placeholder="选择数据位" class="slaveInpu_2">
              <el-option v-for="item in dataBits" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="停止位:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.rs485Config.stop_bits" placeholder="选择停止位" class="slaveInpu_2">
              <el-option v-for="item in stopBits" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="校验位:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.rs485Config.parity" placeholder="选择校验位" class="slaveInpu_2">
              <el-option v-for="item in parities" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>

        </el-form>
        <el-form :model="editChannelForm.comConfig" v-if="editChannelForm.channel_type.indexOf('com')==0"
          style="text-align: left;" label-position="right" :block="true">
          <el-form-item class="formline_1" label="波特率:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.comConfig.baud_rate" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in baudRates" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>&nbsp;bps
          </el-form-item>
          <el-form-item class="formline_1" label="数据位:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.comConfig.data_bits" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in dataBits" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="停止位:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.comConfig.stop_bits" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in stopBits" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="校验位:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.comConfig.parity" placeholder="选择波特率" class="slaveInpu_2">
              <el-option v-for="item in parities" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="断帧时间:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.comConfig.timeout" placeholder="选择断帧时间" class="slaveInpu_2">
              <el-option v-for="item in timeoutOptions" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select> <span v-show="editChannelForm.comConfig.timeout!=0">ms</span>
          </el-form-item>
        </el-form>
        <el-form :model="editChannelForm.ethernetConfig" v-if="editChannelForm.channel_type.indexOf('thernet')>=0"
          style="text-align: left;" block>
          <!-- <el-form-item class="formline_1" style="margin-top:-0.3rem;" label="默认网关:" -->
          <el-form-item class="formline_1" label="自动获取IP:" :label-width="formLabelWidth">
            <el-switch v-model="editChannelForm.ethernetConfig.dhcp" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="是" inactive-text="否" :active-value="one" :inactive-value="zero">
            </el-switch>
          </el-form-item>
          <el-form-item class="formline_1" label="网关IP:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="editChannelForm.ethernetConfig.local_ip" placeholder="输入网关IP地址"
              :disabled="editChannelForm.ethernetConfig.dhcp==1"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="默认网关:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="editChannelForm.ethernetConfig.gateway" placeholder="输入本地默认网关"
              :disabled="editChannelForm.ethernetConfig.dhcp==1"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="子网掩码:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="editChannelForm.ethernetConfig.subnet_mask" placeholder="输入本地子网掩码"
              :disabled="editChannelForm.ethernetConfig.dhcp==1"></el-input>
          </el-form-item>

          <el-form-item class="formline_1" label="DNS:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="editChannelForm.ethernetConfig.dns" placeholder="输入dns"
              :disabled="editChannelForm.ethernetConfig.dhcp==1"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="DNS2:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="editChannelForm.ethernetConfig.dns2" placeholder="输入dns2"
              :disabled="editChannelForm.ethernetConfig.dhcp==1"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="NTP:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="editChannelForm.ethernetConfig.ntp" placeholder="输入ntp"
              :disabled="editChannelForm.ethernetConfig.dhcp==1"></el-input>
          </el-form-item>

         <!-- <el-form-item class="formline_1 local" label="云盒Port:" :label-width="formLabelWidth">
            <el-input class="inpu" v-model="editChannelForm.ethernetConfig.local_port" placeholder="输入云盒Port"
              :disabled="editChannelForm.ethernetConfig.dhcp==1"></el-input><br>
          </el-form-item> -->

        </el-form>
        <el-form :model="editChannelForm.loraConfig" v-if="editChannelForm.channel_type.indexOf('ora')>=0"
          style="text-align: left;" block>
          <el-form-item label="通讯信道:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.loraConfig.channel" placeholder="输入通讯信道">
            </el-input>
            <div class="tip_1">取值范围0-83</div>
          </el-form-item>
          <el-form-item label="模块地址:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.loraConfig.address" placeholder="输入模块地址">
            </el-input>
            <div class="tip_1">取值范围0-65535</div>
          </el-form-item>
          <el-form-item label="空中速率:" :label-width="formLabelWidth">
            <!-- <el-input class="inpu" v-model="loraConfig.air_rate" placeholder="输入网关IP地址"></el-input> -->
            <el-select v-model="editChannelForm.loraConfig.air_rate" placeholder="选择空中速率" class="slaveInpu_2">
              <el-option v-for="item in speeds" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>&nbsp;bps
          </el-form-item>

          <el-form-item class="formline_1" label="断帧时间:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.loraConfig.timeout" placeholder="选择断帧时间" class="slaveInpu_2">
              <el-option v-for="item in timeoutOptions" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select> <span v-show="editChannelForm.loraConfig.timeout!=0">ms</span>
          </el-form-item>
          <el-form-item class="formline_1" label="数据加密:" :label-width="formLabelWidth">
            <el-radio-group v-model="editChannelForm.loraConfig.data_encrypt">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>

          </el-form-item>
          <el-form-item class="formline_1" label="网络ID:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.loraConfig.net_id" placeholder="网络ID"></el-input>
          </el-form-item>

        </el-form>
        <el-form :model="editChannelForm.zigbeeConfig" v-if="editChannelForm.channel_type.indexOf('igbee')>=0"
          style="text-align: left;" block>
          <el-form-item label="通讯信道:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.zigbeeConfig.channel" placeholder="输入通讯信道">
            </el-input>
            <div class="tip_1">取值范围0-83</div>
          </el-form-item>
          <el-form-item label="PAN ID:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.zigbeeConfig.pan_id" placeholder="输入PAN ID">
            </el-input>
            <div class="tip_1">取值范围0-65535</div>
          </el-form-item>
          <el-form-item class="formline_1" label="断帧时间:" :label-width="formLabelWidth">
            <el-select v-model="editChannelForm.zigbeeConfig.timeout" placeholder="选择断帧时间" class="slaveInpu_2">
              <el-option v-for="item in timeoutOptions" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select> <span v-show="editChannelForm.zigbeeConfig.timeout!=0">ms</span>
          </el-form-item>

        </el-form>
       <!-- <el-form :model="editChannelForm.localConfig" v-if="editChannelForm.channel_type.indexOf('ocal')>=0"
          style="text-align: left;" block>
          <el-form-item label="DI数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.localConfig.di_count"
              placeholder="输入通讯信道"></el-input>
          </el-form-item>
          <el-form-item label="DO数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.localConfig.do_count"
              placeholder="输入DO数量"></el-input>
          </el-form-item>
          <el-form-item label="AI数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.localConfig.ai_count"
              placeholder="输入AI数量"></el-input>
          </el-form-item>
          <el-form-item label="AO数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.localConfig.ao_count"
              placeholder="输入AO数量"></el-input>
          </el-form-item>
          <el-form-item label="温度数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.localConfig.temp_count"
              placeholder="输入温度数量"></el-input>
          </el-form-item>
          <el-form-item label="PI数量:" class="formline_1" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editChannelForm.localConfig.pi_count"
              placeholder="输入PI数量"></el-input>
          </el-form-item>

        </el-form> -->
      </div>
      <div style="text-align: right;margin-top:0.6rem;">
        <el-button size="small" @click="editFormVisible = false">取 消</el-button>
        <el-button type="primary" size="small" @click="updateChannel('sure',editChannelForm.channel_type)">确定</el-button>
        <el-button type="primary" size="small" v-if="isOn==1" @click="updateChannel('live',editChannelForm.channel_type)">在线更新</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="addSlaveFormVisible" v-el-dialog-drag v-el-dialog-drag-width
      :width="screenWidth>=1600?'60%':'72%'" append-to-body :show-close="close" top="50px" class="dial">
      <div class="toptit">
        <span>添加子设备</span>
        <span style="float:right;cursor: pointer;" @click="addSlaveFormVisible = false">关闭</span>
      </div>
      <div class="slaveInfo">
        <!-- <span class="leftName">基本信息</span> -->
        <el-form :model="addSlaveForm" inline class="addform">
          <el-form-item label="子设备名称:" :label-width="formLabelWidth2">
            <el-input v-model="addSlaveForm.name" class="inpu" placeholder="输入子设备名称"></el-input>
            <span class="tip_1" style="width:auto;margin-left:1rem;">名称为子设备ID的别名,用于显示和选择,不参与数据传输,勿重名</span>
          </el-form-item><br>
          <el-form-item label="选择端口:" :label-width="formLabelWidth2" class="for_1366" style="margin-top:-0.2rem;">
            <el-select v-model="addSlaveForm.channel" placeholder="选择端口" class="inpu"
              @change="changeAddSlaveChannel(addSlaveForm.channel)">
              <el-option v-for="item in slaveChannels" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="选择协议:" :label-width="formLabelWidth" class="for_1366" style="margin-top:-0.2rem;">
            <el-select v-model="addSlaveForm.slave_protocol" placeholder="协议选择" class="inpu"
              @change="changeAddProtocol(addSlaveForm.slave_protocol)">
              <el-option v-for="item in protocols" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="子设备站号:" :label-width="formLabelWidth2" class="for_1366" style="margin-top:-0.2rem;">
            <el-input v-model="addSlaveForm.slave_addr" class="inpu" @input="changeAddAddr"
              placeholder="输入子设备站号"></el-input>
          </el-form-item>
          <el-form-item label="子设备ID:" :label-width="formLabelWidth" class="for_1366" style="margin-top:-0.2rem;">
            <el-input v-model="addSlaveForm.num" class="inpu" placeholder="输入子设备ID"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <div class="argmentBox">
        <!-- <span class="leftName">配置参数</span> -->
        <el-form :model="modbusMaster" inline class="addform"
          v-if="addSlaveForm.slave_protocol.indexOf('rtu_master')>=0  || addSlaveForm.slave_protocol.indexOf('ascii')>=0"
          style="height:auto;">
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="modbusMaster.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10"
              placeholder="">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="modbusMaster.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="modbusMaster.response_timeout" class="slaveInpu_2" type="number" min="1000" step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item><br>
          <el-form-item label="4区16位写功能选择:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-input v-model="modbusMaster.write16_cmd" class="inpu"></el-input> -->
            <el-select v-model="modbusMaster.write16_cmd" class="slaveInpu_2">
              <el-option v-for="item in cmds_16" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="16位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusMaster.int16_order" class="slaveInpu_2">
              <el-option v-for="item in orders_16" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="32位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusMaster.int32_order" class="slaveInpu_2">
              <el-option v-for="item in orders_32" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="32位浮点数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusMaster.float_order" class="slaveInpu_2">
              <el-option v-for="item in orders_32" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="64位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusMaster.int64_order" class="slaveInpu_2">
              <el-option v-for="item in orders_64" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="64位浮点数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusMaster.double_order" class="slaveInpu_2">
              <el-option v-for="item in orders_64" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="CRC检验方式:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusMaster.crc_mode" placeholder="CRC检验方式" class="slaveInpu_2">
              <el-option v-for="item in crc_modes" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="最大采集长度:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="modbusMaster.max_length" class="slaveInpu_2" type="number" max="125" step="5">
            </el-input>
            <div class="tip_1">最大值:125</div>
          </el-form-item>
          <el-form-item label="非连续地址间隔:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="modbusMaster.framing_interval" class="slaveInpu_2" type="number"  step="2">
            </el-input>
          </el-form-item>
          <el-form-item label="ASCII排序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusMaster.ascii_order" class="slaveInpu_2">
              <el-option   :value="0" label="AB">
              </el-option>
              <el-option   :value="1" label="BA">
              </el-option>
            </el-select>
          </el-form-item>
          <div v-if="deviceData.version==3" style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能,需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="modbusMaster.state_reg.push_interval" class="slaveInpu_2" min="60" type="number"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span><el-button size="mini"
                style="color:deepskyblue;margin-left:0.4rem;" @click="argmentInfo">参数说明</el-button>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="modbusMaster.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="modbusMaster.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="modbusMaster.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="modbusMaster.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="modbusClient" inline class="addform"
          v-if="addSlaveForm.slave_protocol.indexOf('lient')>=0 || addSlaveForm.slave_protocol.indexOf('ver')>=0"
          style="height:auto;">
          <el-form-item label="工作模式:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusClient.work_mode" class="slaveInpu_2">
              <el-option  :value="0" label="边缘采集"></el-option>
              <el-option  :value="1" label="数据透传"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="Server_IP:" :label-width="formLabelWidth2">
            <el-input class="slaveInpu_2" v-model="modbusClient.server_ip" placeholder="输入Server IP地址"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="Server_Port:" :label-width="formLabelWidth2">
            <el-input class="slaveInpu_2" v-model="modbusClient.server_port" placeholder="输入Server端口号">
            </el-input>
          </el-form-item><br>
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="modbusClient.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="modbusClient.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="modbusClient.response_timeout" class="slaveInpu_2" type="number" min="1000" step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item><br>
          <el-form-item label="4区16位写功能选择:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-input v-model="modbusMaster.write16_cmd" class="inpu"></el-input> -->
            <el-select v-model="modbusClient.write16_cmd" class="slaveInpu_2">
              <el-option v-for="item in cmds_16" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="16位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusClient.int16_order" class="slaveInpu_2">
              <el-option v-for="item in orders_16" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="32位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusClient.int32_order" class="slaveInpu_2">
              <el-option v-for="item in orders_32" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="32位浮点数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusClient.float_order" class="slaveInpu_2">
              <el-option v-for="item in orders_32" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="64位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusClient.int64_order" class="slaveInpu_2">
              <el-option v-for="item in orders_64" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="64位浮点数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusClient.double_order" class="slaveInpu_2">
              <el-option v-for="item in orders_64" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="最大采集长度:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="modbusClient.max_length" class="slaveInpu_2" placeholder="">
            </el-input>
            <div class="tip_1">最大值:125</div>
          </el-form-item>
          <el-form-item label="非连续地址间隔:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="modbusClient.framing_interval" class="slaveInpu_2" type="number"  step="2">
            </el-input>
          </el-form-item>
          <el-form-item label="ASCII排序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="modbusClient.ascii_order" class="slaveInpu_2">
              <el-option   :value="0" label="AB">
              </el-option>
              <el-option   :value="1" label="BA">
              </el-option>
            </el-select>
          </el-form-item>
          <div v-if="deviceData.version==3" style="border-top:1px dashed #ccc;margin-top:0.4rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能,需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="modbusClient.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span><el-button size="mini"
                style="color:deepskyblue;margin-left:0.4rem;" @click="argmentInfo">参数说明</el-button>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="modbusClient.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="modbusClient.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="modbusClient.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="modbusClient.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="localSlave" inline class="addform" v-if="deviceData.version==3 && addSlaveForm.slave_protocol=='modbus'"
          style="height:auto;">
          <el-form-item label="Com1使能:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-switch v-model="localSlave.com1" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.com1">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com2使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.com2" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.com2">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com3使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.com3" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.com3">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item><br>
          <el-form-item label="Com4使能:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-switch v-model="localSlave.com4" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.com4">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com5使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.com5" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.com5">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com6使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.com6" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.com6">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item><br>
          <el-form-item label="Com7使能:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-switch v-model="localSlave.com7" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.com7">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com8使能:" label-width="140px" class="formline_1">
           <!-- <el-switch v-model="localSlave.com8" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.com8">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Ethernet1使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.ethernet1" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.ethernet1">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item><br>
          <el-form-item label="Ethernet2使能:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-switch v-model="localSlave.ethernet2" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.ethernet2">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Zigbee1使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.zigbee1" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.zigbee1">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Zigbee2使能:" label-width="140px" class="formline_1">
           <!-- <el-switch v-model="localSlave.zigbee2" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="localSlave.zigbee2">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item><br>

          <el-form-item label="数据映射:" :label-width="formLabelWidth2" class="formline_1">
            <el-radio-group v-model="localSlave.data_map">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="响应延时(秒):" :label-width="formLabelWidth" class="formline_1" style="margin-left:0.5rem">
            <el-input v-model="localSlave.response_delay" class="slaveInpu_2" placeholder="默认为10秒">
            </el-input>
          </el-form-item>
          <div v-for="(item,i) in localEthernetChannels" :key="'lo'+item.value" style="display:inline-block;">
            <!-- <el-form-item  :label="item.label+':'" :label-width="i%3==0?formLabelWidth2:formLabelWidth2" class="formline_1"> -->
            <el-form-item  :label="item.label+':'" :label-width="formLabelWidth" class="formline_1" style="margin-left:0.17rem;">
                <el-input v-model="localSlave[item.formItem]" class="slaveInpu_2" placeholder="">
                </el-input>

            </el-form-item>
          </div>

          <div  style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能,需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="localSlave.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span><el-button size="mini"
                style="color:deepskyblue;margin-left:0.4rem;" @click="argmentInfo">参数说明</el-button>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="localSlave.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="localSlave.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="localSlave.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="localSlave.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="localSlave54" inline class="addform" v-if="deviceData.version==4 && addSlaveForm.slave_protocol=='modbus'"
          style="height:auto;">
          <div v-for="(item,i) in localChannels" :key="'z'+item.value" style="display:inline-block;">
            <el-form-item  :label="item.label+':'" :label-width="i%3==0?formLabelWidth2:formLabelWidth2" class="formline_1">
              <!-- <el-switch v-model="localSlave[item.formItem]" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch> -->
              <el-radio-group v-model="localSlave54[item.formItem]" @change="changeSlaveModel(item.formItem,localSlave54[item.formItem])">
                <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
                <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
              </el-radio-group>
            </el-form-item>
            <!-- 每三个换行 -->
            <br  v-if="i!=0 && ((i+1)%3==0)">
          </div><br>

          <el-form-item label="数据映射:" :label-width="(localChannels.length!=0 && localChannels.length%3===0)?formLabelWidth2:formLabelWidth2" class="formline_1">
            <el-radio-group v-model="localSlave54.data_map">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="响应延时(秒):" :label-width="(localChannels.length!=0 && localChannels.length%3===0)?formLabelWidth2:formLabelWidth2" class="formline_1" style="margin-left:-0.1rem">
            <el-input v-model="localSlave54.response_delay" class="slaveInpu_2" placeholder="默认为10秒">
            </el-input>
          </el-form-item><br>
          <div v-for="(item,i) in localEthernetChannels" :key="'lo'+item.value" style="display:inline-block;">
            <!-- <el-form-item  :label="item.label+':'" :label-width="i%3==0?formLabelWidth2:formLabelWidth2" class="formline_1"> -->
            <el-form-item  :label="item.label+':'" :label-width="i==0?formLabelWidth2:'125px'" class="formline_1"  >
                <el-input v-model="localSlave54[item.formItem]" class="slaveInpu_2" placeholder="">
                </el-input>

            </el-form-item>
          </div>


        </el-form>
        <el-form :model="s7_200_ppi" inline class="addform"
          v-if="addSlaveForm.slave_protocol.indexOf('pi')>=0 || addSlaveForm.slave_protocol.indexOf('rogram')>=0"
          style="height:auto;">
          <el-form-item v-if="addSlaveForm.slave_protocol.indexOf('rogram')>=0" label="PLC类型:"
            :label-width="formLabelWidth2" class="formline_1" style="height:1.1rem;">
            <el-select v-model="s7_200_ppi.plc_type" placeholder="PLC类型选择" class="slaveInpu_2">
              <el-option v-for="item in protocols_PLC" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.1rem;margin-top:-0.3rem;">
            <el-input v-model="s7_200_ppi.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10"></el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth" class="formline_1" style="height:1.1rem;margin-top:-0.3rem;">
            <el-input v-model="s7_200_ppi.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth" class="formline_1" style="height:1.1rem;margin-top:-0.3rem;">
            <el-input v-model="s7_200_ppi.response_timeout" class="slaveInpu_2" type="number" min="1000" step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <div v-if="deviceData.version==3" style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能,需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="s7_200_ppi.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span><el-button size="mini"
                style="color:deepskyblue;margin-left:0.4rem;" @click="argmentInfo">参数说明</el-button>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="s7_200_ppi.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="s7_200_ppi.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="s7_200_ppi.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="s7_200_ppi.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="dl_T645" inline class="addform" v-if="addSlaveForm.slave_protocol.indexOf('645')>=0"
          style="height:auto;">
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="dl_T645.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10"></el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="dl_T645.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="dl_T645.response_timeout" class="slaveInpu_2" type="number" min="1000" step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
        </el-form>
        <el-form :model="s7_1200_1500" inline class="addform"
          v-if="addSlaveForm.slave_protocol.indexOf('mart')>=0 || addSlaveForm.slave_protocol.indexOf('1200')>=0 || addSlaveForm.slave_protocol.indexOf('1500')>=0  || addSlaveForm.slave_protocol.indexOf('300')>=0 || addSlaveForm.slave_protocol.toLowerCase()=='s7_200'"
          style="height:auto;">
          <el-form-item label="工作模式:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="s7_1200_1500.work_mode" class="slaveInpu_2">
              <el-option  :value="0" label="边缘采集"></el-option>
              <el-option  :value="1" label="数据透传"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="PLC IP:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="s7_1200_1500.server_ip" placeholder="输入PLC IP地址"></el-input>
            <span class="tip_1" style="margin-left:1rem;">PLC端口固定为102，不可更改</span>
          </el-form-item>
          <el-form-item class="formline_1" label="PLC端口:" :label-width="formLabelWidth" v-show="false">
            <el-input class="inpu_2" v-model="s7_1200_1500.server_port" placeholder="输入PLC端口号"></el-input>
          </el-form-item>
          <br>
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="s7_1200_1500.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="s7_1200_1500.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="s7_1200_1500.response_timeout" class="slaveInpu_2" type="number" min="1000" step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item><br>
          <el-form-item label="机架号:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="s7_1200_1500.rack_num" class="slaveInpu_2" placeholder="输入机架号"></el-input>
          </el-form-item>
          <el-form-item label="槽号:" :label-width="formLabelWidth" class="formline_1">
            <el-input v-model="s7_1200_1500.slot_num" class="slaveInpu_2" placeholder="输入槽号"></el-input>
          </el-form-item>
          <div v-if="deviceData.version==3" style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能,需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="s7_1200_1500.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span><el-button size="mini"
                style="color:deepskyblue;margin-left:0.4rem;" @click="argmentInfo">参数说明</el-button>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="s7_1200_1500.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="s7_1200_1500.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="s7_1200_1500.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="s7_1200_1500.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="fx_serial_port" inline class="addform" v-if="addSlaveForm.slave_protocol.indexOf('erial')>=0"
          style="height:auto;">
          <el-form-item label="PLC类型:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-select v-model="fx_serial_port.plc_type" placeholder="PLC类型选择" class="slaveInpu_2">
              <el-option v-for="item in protocols_PLC" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="协议格式:" :label-width="formLabelWidth" class="formline_1">
            <el-select v-model="fx_serial_port.protocol_format" class="slaveInpu_2">
              <el-option v-for="item in famtterFxs" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="是否效验:" :label-width="formLabelWidth" class="formline_1">
            <el-select v-model="fx_serial_port.is_check" class="slaveInpu_2">
              <el-option v-for="item in checkFxs" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1"
            style="height:1.2rem;margin-top:-0.4rem;">
            <el-input v-model="fx_serial_port.poll_cycle" class="slaveInpu_2" type="number" min="0"
              step="10"></el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth" class="formline_1"
            style="height:1.2rem;margin-top:-0.4rem;">
            <el-input v-model="fx_serial_port.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth" class="formline_1"
            style="height:1.2rem;margin-top:-0.4rem;">
            <el-input v-model="fx_serial_port.response_timeout" class="slaveInpu_2" type="number" min="1000" step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <div v-if="deviceData.version==3" style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能，需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="fx_serial_port.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span><el-button size="mini"
                style="color:deepskyblue;margin-left:0.4rem;" @click="argmentInfo">参数说明</el-button>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1" style="margin-top:-0.2rem;">
              <el-switch v-model="fx_serial_port.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1" style="margin-top:-0.2rem;">
              <el-input v-model="fx_serial_port.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="fx_serial_port.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="fx_serial_port.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <div style="text-align: right;">
        <el-button size="small" @click="addSlaveFormVisible = false">取 消</el-button>
        <el-button type="primary" size="small" @click="addSlave">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="editSlaveFormVisible" v-el-dialog-drag v-el-dialog-drag-width
      :width="screenWidth>=1600?'60%':'72%'" append-to-body :show-close="close" top="50px" class="dial">
      <div class="toptit">
        <span>编辑子设备</span>
        <span style="float:right;cursor: pointer;" @click="editSlaveFormVisible = false">关闭</span>
      </div>
      <div class="slaveInfo">
        <!-- <span class="leftName">基本信息</span> -->
        <el-form :model="editSlaveForm" inline class="addform">
          <el-form-item label="子设备名称:" :label-width="formLabelWidth2">
            <el-input v-model="editSlaveForm.name" class="inpu" placeholder="输入子设备名称"></el-input>
            <span class="tip_1" style="width:auto;margin-left:1rem;">名称为子设备ID的别名,用于显示和选择,不参与数据传输,勿重名</span>
          </el-form-item><br>
          <el-form-item label="选择端口:" :label-width="formLabelWidth2" class="for_1366" style="margin-top:-0.2rem;">
            <!-- <el-select v-model="editSlaveForm.channel" placeholder="选择端口" class="inpu"
							@change="changeEditSlaveChannel(editSlaveForm.channel)" disabled> -->
            <el-select v-model="editSlaveForm.channel" placeholder="选择端口" class="inpu" disabled>
              <el-option v-for="item in slaveChannels" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="选择协议:" :label-width="formLabelWidth" class="for_1366" style="margin-top:-0.2rem;">
            <el-select v-model="editProtocol" placeholder="协议选择" class="inpu" @change="changeEditProtocol(editProtocol)"
              :disabled="editSlaveForm.sensors_count!=0">
              <el-option v-for="item in protocols" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="子设备站号:" :label-width="formLabelWidth2" class="for_1366" style="margin-top:-0.2rem;">
            <el-input v-model="editSlaveForm.slave_addr" class="inpu" @input="changeEditAddr"
              placeholder="输入子设备站号"></el-input>
          </el-form-item>
          <el-form-item label="子设备ID:" :label-width="formLabelWidth" class="for_1366" style="margin-top:-0.2rem;">
            <el-input v-model="editSlaveForm.num" class="inpu" placeholder="输入子设备地址"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <div class="argmentBox">
        <el-form :model="editModbusMaster" inline class="addform"
          v-if="editProtocol.indexOf('rtu_master')>=0 || editProtocol.indexOf('ascii')>=0" style="height:auto;">
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editModbusMaster.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editModbusMaster.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editModbusMaster.response_timeout" class="slaveInpu_2" type="number" min="1000"
              step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item><br>
          <el-form-item label="4区16位写功能选择:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-input v-model="modbusMaster.write16_cmd" class="inpu"></el-input> -->
            <el-select v-model="editModbusMaster.write16_cmd" class="slaveInpu_2">
              <el-option v-for="item in cmds_16" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="16位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusMaster.int16_order" class="slaveInpu_2">
              <el-option v-for="item in orders_16" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="32位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusMaster.int32_order" class="slaveInpu_2">
              <el-option v-for="item in orders_32" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="32位浮点数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusMaster.float_order" class="slaveInpu_2">
              <el-option v-for="item in orders_32" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="64位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusMaster.int64_order" class="slaveInpu_2">
              <el-option v-for="item in orders_64" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="64位浮点数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusMaster.double_order" class="slaveInpu_2">
              <el-option v-for="item in orders_64" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="CRC检验方式:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusMaster.crc_mode" placeholder="CRC检验方式" class="slaveInpu_2">
              <el-option v-for="item in crc_modes" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="最大采集长度:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="editModbusMaster.max_length" class="slaveInpu_2" type="number" max="125" step="5">
            </el-input>
            <div class="tip_1">最大值:125</div>
          </el-form-item>
          <el-form-item label="非连续地址间隔:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="editModbusMaster.framing_interval" class="slaveInpu_2" type="number"  step="2">
            </el-input>
          </el-form-item>
          <el-form-item label="ASCII排序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusMaster.ascii_order" class="slaveInpu_2">
              <el-option   :value="0" label="AB">
              </el-option>
              <el-option   :value="1" label="BA">
              </el-option>
            </el-select>
          </el-form-item>
          <div v-if="deviceData.version==3 && editModbusMaster.state_reg"
            style="border-top:1px dashed #ccc;margin-top:0.4rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能，需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editModbusMaster.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editModbusMaster.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editModbusMaster.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editModbusMaster.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editModbusMaster.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="editModbusClient" inline class="addform"
          v-if="editProtocol.indexOf('lient')>=0 || editProtocol.indexOf('ver')>=0" style="height:auto;">
          <el-form-item label="工作模式:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusClient.work_mode" class="slaveInpu_2">
              <el-option  :value="0" label="边缘采集"></el-option>
              <el-option  :value="1" label="数据透传"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="Server_IP:" :label-width="formLabelWidth2">
            <el-input class="slaveInpu_2" v-model="editModbusClient.server_ip" placeholder="输入Server IP地址"></el-input>
          </el-form-item>
          <el-form-item class="formline_1" label="Server_Port:" :label-width="formLabelWidth2">
            <el-input class="slaveInpu_2" v-model="editModbusClient.server_port" placeholder="输入Server端口号">
            </el-input>
          </el-form-item><br>
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editModbusClient.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editModbusClient.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editModbusClient.response_timeout" class="slaveInpu_2" type="number" min="1000"
              step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item><br>
          <el-form-item label="4区16位写功能选择:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-input v-model="modbusMaster.write16_cmd" class="inpu"></el-input> -->
            <el-select v-model="editModbusClient.write16_cmd" class="slaveInpu_2">
              <el-option v-for="item in cmds_16" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="16位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusClient.int16_order" class="slaveInpu_2">
              <el-option v-for="item in orders_16" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="32位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusClient.int32_order" class="slaveInpu_2">
              <el-option v-for="item in orders_32" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="32位浮点数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusClient.float_order" class="slaveInpu_2">
              <el-option v-for="item in orders_32" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="64位整数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusClient.int64_order" class="slaveInpu_2">
              <el-option v-for="item in orders_64" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="64位浮点数解码顺序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusClient.double_order" class="slaveInpu_2">
              <el-option v-for="item in orders_64" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="最大采集长度:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="editModbusClient.max_length" class="slaveInpu_2" type="number" max="125" step="5">
            </el-input>
            <div class="tip_1">最大值:125</div>
          </el-form-item>
          <el-form-item label="非连续地址间隔:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="editModbusClient.framing_interval" class="slaveInpu_2" type="number"  step="2">
            </el-input>
          </el-form-item>
          <el-form-item label="ASCII排序:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editModbusClient.ascii_order" class="slaveInpu_2">
              <el-option   :value="0" label="AB">
              </el-option>
              <el-option   :value="1" label="BA">
              </el-option>
            </el-select>
          </el-form-item>
          <div v-if="deviceData.version==3 && editModbusClient.state_reg"
            style="border-top:1px dashed #ccc;margin-top:0.4rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能，需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editModbusClient.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editModbusClient.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editModbusClient.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editModbusClient.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editModbusClient.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="editLocalSlave" inline class="addform" v-if="deviceData.version==3 && editProtocol=='modbus'"
          style="height:auto;">
          <el-form-item label="Com1使能:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-switch v-model="localSlave.com1" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.com1">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com2使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.com2" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.com2">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com3使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.com3" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.com3">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item><br>
          <el-form-item label="Com4使能:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-switch v-model="localSlave.com4" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.com4">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com5使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.com5" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.com5">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com6使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.com6" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.com6">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item><br>
          <el-form-item label="Com7使能:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-switch v-model="localSlave.com7" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.com7">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Com8使能:" label-width="140px" class="formline_1">
           <!-- <el-switch v-model="localSlave.com8" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.com8">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Ethernet1使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.ethernet1" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.ethernet1">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item><br>
          <el-form-item label="Ethernet2使能:" :label-width="formLabelWidth2" class="formline_1">
            <!-- <el-switch v-model="localSlave.ethernet2" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.ethernet2">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Zigbee1使能:" label-width="140px" class="formline_1">
            <!-- <el-switch v-model="localSlave.zigbee1" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.zigbee1">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="Zigbee2使能:" label-width="140px" class="formline_1">
           <!-- <el-switch v-model="localSlave.zigbee2" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch> -->
            <el-radio-group v-model="editLocalSlave.zigbee2">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item><br>

          <el-form-item label="数据映射:" :label-width="formLabelWidth2" class="formline_1">
            <el-radio-group v-model="editLocalSlave.data_map">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="响应延时(秒):" :label-width="formLabelWidth" class="formline_1" style="margin-left:0.5rem">
            <el-input v-model="editLocalSlave.response_delay" class="slaveInpu_2" placeholder="默认为10秒">
            </el-input>
          </el-form-item>
          <div v-for="(item,i) in localEthernetChannels" :key="'lo'+item.value" style="display:inline-block;">
            <!-- <el-form-item  :label="item.label+':'" :label-width="i%3==0?formLabelWidth2:formLabelWidth2" class="formline_1"> -->
            <el-form-item  :label="item.label+':'" :label-width="formLabelWidth" class="formline_1" style="margin-left:0.17rem;">
                <el-input v-model="editLocalSlave[item.formItem]" class="slaveInpu_2" placeholder="">
                </el-input>

            </el-form-item>
          </div>
          <div  style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能,需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editLocalSlave.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span><el-button size="mini"
                style="color:deepskyblue;margin-left:0.4rem;" @click="argmentInfo">参数说明</el-button>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editLocalSlave.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editLocalSlave.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editLocalSlave.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;margin-left:-0.9rem!important;" active-color="#13ce66"
                inactive-color="#ccc" active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editLocalSlave.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="editLocalSlave" inline class="addform" v-if="deviceData.version==4 && editProtocol=='modbus'"
          style="height:auto;">
          <div v-for="(item,i) in localChannels" :key="'z'+item.value" style="display:inline-block;">
            <el-form-item  :label="item.label+':'" :label-width="i%3==0?formLabelWidth2:formLabelWidth2" class="formline_1">
              <!-- <el-switch v-model="localSlave[item.formItem]" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch> -->
              <el-radio-group v-model="editLocalSlave[item.formItem]" @change="changeSlaveModel(item.formItem,editLocalSlave[item.formItem])">
                <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
                <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
              </el-radio-group>
            </el-form-item>
            <!-- 每三个换行 -->
            <br  v-if="i!=0 && ((i+1)%3==0)">
          </div><br>

          <el-form-item label="数据映射:" :label-width="(localChannels.length!=0 && localChannels.length%3===0)?formLabelWidth2:formLabelWidth2" class="formline_1">
            <el-radio-group v-model="editLocalSlave.data_map">
              <el-radio :label="1" style="font-size:0.3rem;">开</el-radio>
              <el-radio :label="0" style="font-size:0.3rem;">关</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="响应延时(秒):" :label-width="(localChannels.length!=0 && localChannels.length%3===0)?formLabelWidth2:formLabelWidth2" class="formline_1" style="margin-left:-0.1rem">
            <el-input v-model="editLocalSlave.response_delay" class="slaveInpu_2" placeholder="默认为10秒">
            </el-input>
          </el-form-item><br>
          <div v-for="(item,i) in localEthernetChannels" :key="'lo'+item.value" style="display:inline-block;">
            <!-- <el-form-item  :label="item.label+':'" :label-width="i%3==0?formLabelWidth2:formLabelWidth2" class="formline_1"> -->
            <el-form-item  :label="item.label+':'" :label-width="i==0?formLabelWidth2:'125px'" class="formline_1"  >
                <el-input v-model="editLocalSlave[item.formItem]" class="slaveInpu_2" placeholder="">
                </el-input>

            </el-form-item>
          </div>


        </el-form>
        <!-- <el-form :model="editLocalSlave" inline class="addform" v-if="editProtocol=='modbus'" style="height:auto;">
          <el-form-item label="Ethernet_0使能:" :label-width="formLabelWidth2" class="formline_1">
            <el-switch v-model="editLocalSlave.ethernet_0" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch>
          </el-form-item>
          <el-form-item label="RS485_0使能:" :label-width="formLabelWidth" class="formline_1">
            <el-switch v-model="editLocalSlave.rs485_0" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch>
          </el-form-item>
          <el-form-item label="RS485_1使能:" :label-width="formLabelWidth" class="formline_1">
            <el-switch v-model="editLocalSlave.rs485_1" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch>
          </el-form-item><br>
          <el-form-item label="RS485_2使能:" :label-width="formLabelWidth2" class="formline_1">
            <el-switch v-model="editLocalSlave.rs485_2" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch>
          </el-form-item>
          <el-form-item label="RS232_0使能:" :label-width="formLabelWidth" class="formline_1">
            <el-switch v-model="editLocalSlave.rs232_0" :width="stateWidth" class="demo"
              style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
              active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
            </el-switch>
          </el-form-item>
          <el-form-item label="响应延时(秒):" :label-width="formLabelWidth" class="formline_1">
            <el-input v-model="editLocalSlave.response_delay" class="slaveInpu_2" placeholder="默认为10秒">
            </el-input>
          </el-form-item>

          <div v-if="deviceData.version==3 && editLocalSlave.state_reg" style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能，需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editLocalSlave.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editLocalSlave.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editLocalSlave.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editLocalSlave.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editLocalSlave.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form> -->
        <el-form :model="editS7_200_ppi" inline class="addform"
          v-if="editProtocol.indexOf('pi')>=0 || editProtocol.indexOf('rogram')>=0" style="height:auto;">
          <el-form-item v-if="editProtocol.indexOf('rogram')>=0" label="PLC类型:" :label-width="formLabelWidth2"
            class="formline_1" style="height:1.1rem;">
            <el-select v-model="editS7_200_ppi.plc_type" placeholder="PLC类型选择" class="slaveInpu_2">
              <el-option v-for="item in protocols_PLC" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.1rem;margin-top:-0.3rem;">
            <el-input v-model="editS7_200_ppi.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth" class="formline_1" style="height:1.1rem;margin-top:-0.3rem;">
            <el-input v-model="editS7_200_ppi.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth" class="formline_1" style="height:1.1rem;margin-top:-0.3rem;">
            <el-input v-model="editS7_200_ppi.response_timeout" class="slaveInpu_2" type="number" min="1000" step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <div v-if="deviceData.version==3 && editS7_200_ppi.state_reg" style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能，需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editS7_200_ppi.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editS7_200_ppi.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editS7_200_ppi.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editS7_200_ppi.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editS7_200_ppi.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="editDL_T645" inline class="addform" v-if="editProtocol.indexOf('645')>=0" style="height:auto;">
          <el-form-item label="轮询周期:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editDL_T645.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editDL_T645.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editDL_T645.response_timeout" class="slaveInpu_2" type="number" min="1000" step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
        </el-form>
        <el-form :model="editS7_1200_1500" inline class="addform"
          v-if="editProtocol.indexOf('mart')>=0 || editProtocol.indexOf('1200')>=0 || editProtocol.indexOf('1500')>=0 || editProtocol.indexOf('300')>=0 || editProtocol.toLowerCase()=='s7_200'"
          style="height:auto;">
          <el-form-item label="工作模式:" :label-width="formLabelWidth2" class="formline_1">
            <el-select v-model="editS7_1200_1500.work_mode" class="slaveInpu_2">
              <el-option  :value="0" label="边缘采集"></el-option>
              <el-option  :value="1" label="数据透传"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="formline_1" label="PLC IP:" :label-width="formLabelWidth">
            <el-input class="slaveInpu_2" v-model="editS7_1200_1500.server_ip" placeholder="输入PLC IP地址"></el-input>
            <span class="tip_1" style="margin-left:1rem;">PLC端口固定为102，不可更改</span>
          </el-form-item>
          <el-form-item class="formline_1" label="PLC端口:" :label-width="formLabelWidth" v-show="false">
            <el-input class="inpu_2" v-model="editS7_1200_1500.server_port" placeholder="输入PLC端口号">
            </el-input>
          </el-form-item>
          <br>
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editS7_1200_1500.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editS7_1200_1500.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth" class="formline_1" style="height:1.2rem;">
            <el-input v-model="editS7_1200_1500.response_timeout" class="slaveInpu_2" type="number" min="1000"
              step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item><br>
          <el-form-item label="机架号:" :label-width="formLabelWidth2" class="formline_1">
            <el-input v-model="editS7_1200_1500.rack_num" class="slaveInpu_2" placeholder="输入机架号">
            </el-input>
          </el-form-item>
          <el-form-item label="槽号:" :label-width="formLabelWidth" class="formline_1">
            <el-input v-model="editS7_1200_1500.slot_num" class="slaveInpu_2" placeholder="输入槽号"></el-input>
          </el-form-item>
          <div v-if="deviceData.version==3 && editS7_1200_1500.state_reg"
            style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能，需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editS7_1200_1500.state_reg.push_interval" class="slaveInpu_2" type="number" min="60"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editS7_1200_1500.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editS7_1200_1500.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editS7_1200_1500.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editS7_1200_1500.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
        <el-form :model="editFx_serial_port" inline class="addform" v-if="editProtocol.indexOf('erial')>=0"
          style="height:auto;">
          <el-form-item label="PLC类型:" :label-width="formLabelWidth2" class="formline_1" style="height:1.2rem;">
            <el-select v-model="editFx_serial_port.plc_type" placeholder="PLC类型选择" class="slaveInpu_2">
              <el-option v-for="item in protocols_PLC" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="协议格式:" :label-width="formLabelWidth" class="formline_1">
            <el-select v-model="editFx_serial_port.protocol_format" class="slaveInpu_2">
              <el-option v-for="item in famtterFxs" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="是否效验:" :label-width="formLabelWidth" class="formline_1">
            <el-select v-model="editFx_serial_port.is_check" class="slaveInpu_2">
              <el-option v-for="item in checkFxs" :key="item.value" :value="item.value" :label="item.label">
              </el-option>
            </el-select>
          </el-form-item><br>
          <el-form-item label="轮询周期:" :label-width="formLabelWidth2" class="formline_1"
            style="height:1.2rem;margin-top:-0.4rem;">
            <el-input v-model="editFx_serial_port.poll_cycle" class="slaveInpu_2" type="number" min="0" step="10">
            </el-input>
            <div class="tip_1">单位:s(秒)</div>
          </el-form-item>
          <el-form-item label="指令间隔:" :label-width="formLabelWidth" class="formline_1"
            style="height:1.2rem;margin-top:-0.4rem;">
            <el-input v-model="editFx_serial_port.poll_interval" class="slaveInpu_2" type="number" min="10" step="10">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <el-form-item label="超时时长:" :label-width="formLabelWidth" class="formline_1"
            style="height:1.2rem;margin-top:-0.4rem;">
            <el-input v-model="editFx_serial_port.response_timeout" class="slaveInpu_2" type="number" min="1000"
              step="500">
            </el-input>
            <div class="tip_1">单位:ms(毫秒)</div>
          </el-form-item>
          <div v-if="deviceData.version==3 && editFx_serial_port.state_reg"
            style="border-top:1px dashed #ccc;margin-top:0.1rem;padding-top:0.1rem;">
            <div class="tip_1" style="width:100%;color:red;padding-left:2.2rem;margin-bottom:0.2rem;font-size:0.3rem;">
              注：以下为状态寄存器功能，需要固件版本的支持,最低版本V5.1.0,如不确定版本号,请不要使用!</div>
            <el-form-item label="下发频率:" :label-width="formLabelWidth2" class="formline_1">
              <el-input v-model="editFx_serial_port.state_reg.push_interval" class="slaveInpu_2" min="60" type="number"
                step="10" placeholder="">
              </el-input>
              <span class="tip_1">单位:s(秒),最低60s</span>
            </el-form-item><br>
            <el-form-item label="心跳使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editFx_serial_port.state_reg.ping_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="心跳地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editFx_serial_port.state_reg.ping_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item><br>
            <el-form-item label="状态使能:" :label-width="formLabelWidth2" class="formline_1">
              <el-switch v-model="editFx_serial_port.state_reg.state_enable" :width="stateWidth" class="demo"
                style="display:inline-block;vertical-align:top;" active-color="#13ce66" inactive-color="#ccc"
                active-text="开" inactive-text="关" :active-value="one" :inactive-value="zero">
              </el-switch>
            </el-form-item>
            <el-form-item label="状态地址:" :label-width="formLabelWidth" class="formline_1">
              <el-input v-model="editFx_serial_port.state_reg.state_address" class="slaveInpu_2" placeholder="">
              </el-input>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <div style="text-align: right;">
        <el-button size="small" @click="cancelEditSlave">取 消</el-button>
        <el-button type="primary" size="small" @click="modifySlave">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="copySlaveVisible" width="26%" v-el-dialog-drag v-el-dialog-drag-width append-to-body
      :show-close="close" top="180px" class="dial">
      <div class="toptit">
        <span>复制子设备-{{copySlaveForm.old_slave_name}}</span>
        <span style="float:right;cursor: pointer;" @click="copySlaveVisible = false">关闭</span>
      </div>
      <el-form :model="copySlaveForm" style="text-align: left;margin-top:0.2rem;" block>
        <!-- <el-form-item label="选择设备:" :label-width="formLabelWidth2" class="for_1366" style="margin-top:-0.2rem;">
          <el-select v-model="addSlaveForm.equip_id" placeholder="选择端口" class="inpu">
            <el-option v-for="item in slaveChannels" :key="item.value" :value="item.value" :label="item.label">
            </el-option>
          </el-select>
        </el-form-item> -->
        <!-- <el-form-item label="原子设备:" :label-width="formLabelWidth">
          <el-select v-model="copySlaveForm.id" placeholder="选择原子设备" class="inpu">
            <el-option v-for="item in slaves" :key="item.value" :value="item.value" :label="item.label">
            </el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item label="选择端口:" :label-width="formLabelWidth" >
          <!-- <el-select v-model="copySlaveForm.channel_id" placeholder="选择端口" class="inpu" @change="changeCopySlave(copySlaveForm.channel_id)">
            <el-option v-for="item in slaveChannels" :disabled="item.label.indexOf('ocal')>=0" :key="item.value" :value="item.value" :label="item.label">
            </el-option>
          </el-select> -->
          <el-select v-model="copySlaveForm.channel_id" placeholder="选择端口" class="inpu">
            <el-option v-for="item in slaveChannels" v-if="item.label.indexOf('ocal')<0" :key="item.value" :value="item.value" :label="item.label">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="新子设备名称:" :label-width="formLabelWidth">
          <el-input class="inpu" v-model="copySlaveForm.slave_name" placeholder="新子设备名称">
          </el-input>
        </el-form-item>
        <el-form-item label="新子设备　ID:" :label-width="formLabelWidth">
          <el-input class="inpu" v-model="copySlaveForm.slave_no" placeholder="新子设备ID">
          </el-input>
        </el-form-item>
        <el-form-item  label="新子设备站号:" :label-width="formLabelWidth">
          <el-input class="inpu" v-model="copySlaveForm.slave_addr" placeholder="新子设备站号">
          </el-input>
        </el-form-item>

      </el-form>
      <div style="text-align: right;margin-top:0.3rem;">
        <el-button size="small" @click="copySlaveVisible = false">取 消</el-button>
        <el-button type="primary" size="small" @click="sureCopySlave">确定</el-button>

      </div>
    </el-dialog>
    <el-dialog :visible="teamListVisible" v-el-dialog-drag v-el-dialog-drag-width width="60%" append-to-body
      :show-close="close" class="teamList dial" top="80px">
      <div class="toptit">
        <span>数据点分组管理</span>
        <span  @click="closeTeamList">关闭</span>
      </div>
      <div class="header_bottom" style="margin-top:0.1rem;">
        <el-button type="success" size="mini" style="padding:6px;" @click="addTeam">添加分组</el-button><span class="tip_1"
          v-if="!screen_1360"
          style="color:red;margin-left:0.2rem;margin-bottom:0.2rem;font-size:0.25rem;">主要作用于实时数据监控,支持跨子设备分组,默认按子设备分组,如不需要额外分组,可忽略此功能！此功能与硬件模块无关，修改后无需下发！</span>
        <!-- <el-button type="primary" size="small" @click="groupInfo" >功能说明</el-button> -->
        <!--<el-button type="danger" size="small"  @click="deleteGoods">删除</el-button>-->
      </div>
      <div class="container_table">
        <el-table :data="tabledata" size="small" border style="width:100%;" :header-cell-style="{
					'background-color':tableHead,
					'color': 'white',
			        'fontSize':'0.3rem',
					'height':'0.6rem',
					'line-height':'0.6rem',
					'padding':'0.1rem'
				}" :cell-style="{'fontSize':'0.3rem'}">
          <!-- <el-table-column type="selection" min-width="30">
					</el-table-column> -->
          <el-table-column label="ID" prop="id" align="center" min-width="50">
          </el-table-column>
          <el-table-column prop="sgroup_name" label="分组名称" align="center" min-width="250">
          </el-table-column>
          <!-- <el-table-column label="缩略图" align="center" min-width="70">
						<template slot-scope="scope">
							<img :src="baseurl+scope.row.sgroup_icon" style="width:50px;height:34px;vertical-align: middle;" />
						</template>
					</el-table-column> -->
          <el-table-column prop="sensors_count" label="数据点数量" align="center" min-width="100">
          </el-table-column>
          <el-table-column prop="list_order" label="排序" align="center" min-width="80">
          </el-table-column>
          <!-- <el-table-column prop="addTime" label="添加时间" align="center" min-width="150">
					</el-table-column> -->
          <el-table-column label="操作" min-width="150" align="center">
            <template slot-scope="scope">
              <el-button type="primary" size="mini" @click="editTeam(scope.row)">编辑</el-button>
              <!-- <el-button type="primary" size="mini" @click="authorize(scope.row)">分配</el-button> -->
              <el-button @click="sureDeleteTeam(scope.row)" type="danger" :disabled="scope.row.sensors_count!=0"
                size="mini">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="pagination">
          <el-pagination @size-change="handleSizeChange" @current-change="current_change"
            :current-page="queryParams.pageNo" :page-size="queryParams.pageSize" :page-sizes="[5,10,15]"
            layout="total, sizes, prev, pager, next, jumper" :total="queryParams.total">
          </el-pagination>
        </div>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="teamAddVisible" width="25%" append-to-body :show-close="close">
      <div class="toptit">
        <span>添加分组</span>
        <span style="float:right;cursor: pointer;" @click="teamAddVisible = false">关闭</span>
      </div>
      <el-form :model="addTeamForm" style="text-align: left;margin-top:0.2rem;" block>
        <el-form-item label="名称:" label-width="auto">
          <el-input class="inpu" v-model="addTeamForm.sgroup_name" placeholder="分组名称"></el-input>
        </el-form-item>
        <el-form-item label="排序:" label-width="auto">
          <el-input class="inpu" style="width:2.5rem" v-model="addTeamForm.list_order" placeholder="排序数值"></el-input>
        </el-form-item>
      </el-form>
      <div style="text-align: right;">
        <el-button type="primary" size="small" @click="sureAddTeam">确 定</el-button>
        <el-button size="small" @click="teamAddVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="teamEditVisible" width="25%" append-to-body :show-close="close">
      <div class="toptit">
        <span>编辑分组</span>
        <span style="float:right;cursor: pointer;" @click="teamEditVisible = false">关闭</span>
      </div>
      <el-form :model="editTeamForm" style="text-align: left;margin-top:0.2rem;" block>
        <el-form-item label="名称:" label-width="auto">
          <el-input class="inpu" v-model="editTeamForm.sgroup_name" placeholder="分组名称"></el-input>
        </el-form-item>
        <el-form-item label="排序:" label-width="auto">
          <el-input class="inpu" style="width:2.5rem" v-model="editTeamForm.list_order" placeholder="排序数值"></el-input>
        </el-form-item>
      </el-form>
      <div style="text-align: right;">
        <el-button type="primary" size="small" @click="sureEditTeam">确 定</el-button>
        <el-button size="small" @click="cancelEdit">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible="dialogInfoVisible" v-el-dialog-drag v-el-dialog-drag-width width="30%" append-to-body
      top="200px" class="dial" :show-close="close">
      <div class="toptit">
        <span>状态寄存器参数说明</span>
        <span style="float:right;cursor: pointer;" @click="dialogInfoVisible=false">关闭</span>
      </div>
      <div class="infocontent">
        <!-- <h2 style="width:100%;text-align: center;margin-top:0.2rem;"></h2><br> -->

        <h4>频率与使能：</h4>
        1.根据下发频率(时间间隔)定时给心跳地址定时发送0/1跳变,使能确定其是否使用;<br>
        2.根据下发频率(时间间隔)定时给状态地址定时发送状态码,1表示正常,0表示未初始化,2表示联网异常,使能确定其是否使用;<br>
        <h4>心跳地址和状态地址分区默认规则：</h4>
        1.Modbus系列协议默认为4区地址;<br>
        2.S7 200系列协议默认为VW区地址;<br>
        3.三菱FX系列协议默认为D区地址;<br>
        4.S7 1200协议和S7 1500协议默认为DB区地址;
      </div>
    </el-dialog>
    <el-dialog :visible="formulaInfoVisible" :width="win.screen.width>=1600?'47%':'67%'" :show-close="false"
      append-to-body top="200px" class="dial">
      <div class="toptit">
        <span>计算公式说明</span>
        <span style="float:right;cursor: pointer;" @click="formulaInfoVisible=false">关闭</span>
      </div>
      <div class="infocontent" style="margin-top:0.2rem;">
        <!-- <h2 style="width:100%;text-align: center;margin-top:0.2rem;"></h2><br> -->
        <p>
          1.目前只支持的+,-,*(乘),/(除)四则运算及其组合,支持跨子设备(组)运算；<br>
          2.计算公式请全部使用英文字符书写；<br>
          3.计算公式基本组成：变量地址 运算符 其他变量地址或数值；<br>
          4.变量地址模板：$devices[子设备ID]["variables"][数据点地址],示例：$devices["Local"]["variables"]["0x00001"]；<br>
          <!-- 5.建议使用公式生成器生成公式，生成后，点击左侧计算公式输入框自动填入；<br> -->
          5.点击变量自动生成变量地址，可先点击完所有变量，然后插入运算符(变量地址之间的留空处($符之前))，也可顺序点击，顺序输入运算符；<br>
          6.需要改变计算公式的运算优先级时，请使用英文小括号"()",不支持中括号和大括号；<br>
          7.公式示例：($devices["Local"]["variables"]["0x00001"] + 3) * 10 + $devices["Local"]["variables"]["0x00002"] * 100；
        </p>
      </div>
    </el-dialog>
    <div v-if="manyFilterVisible" class="filterBox" :class="!isFilter?'filterBoxCenter':'filterBoxLeft'">
      <div class="toptit" style="font-size:0.3rem;background-color: #fff;border-bottom:1px solid #ccc;color:#666;">
        <span style="font-size:0.3rem;">数据点批量筛选</span>
        <span style="float:right;cursor: pointer;" @click="closeFilter">关闭</span>
      </div>
      <el-form :model="filterManyForm" inline
        style="text-align:left;font-size:0.3rem;margin-top:0.7rem;line-height:0.9rem;">
        <el-form-item class="formline_2" style="width:100%;" label="名称关键字:" label-width="1.8rem">
          <el-input class="inpu_3 over" style="vertical-align: bottom;width:3.5rem;" v-model="filterManyForm.sensorKey"
            placeholder="空为全部,可忽略"></el-input>
        </el-form-item>
        <el-form-item class="formline_2" style="width:100%;" label="所属分组:" label-width="1.8rem">
          <el-select v-model="filterManyForm.sgroup_id" class="inpu_3" style="vertical-align: bottom;width:3.5rem;">
            <el-option v-for="item in filterGroups" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item class="formline_2" style="width:100%;" label="数据属性:" label-width="1.8rem">
          <el-select v-model="filterManyForm.report_type" class="inpu_3" style="vertical-align: bottom;width:3.5rem;">
            <el-option v-for="item in filterReportTypes" :key="item.value" :value="item.value" :label="item.label">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item class="formline_2" style="width:100%;" label="读写/显示:" label-width="1.8rem">
          <el-select v-model="filterManyForm.show_type" placeholder="读写/显示:" class="inpu_3"
            style="vertical-align: bottom;width:3.5rem;">
            <el-option v-for="item in filterShowTypes" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item class="formline_2" style="width:100%;" label="数据存储:" label-width="1.8rem">
          <el-select v-model="filterManyForm.save_type" placeholder="是否存储" class="inpu_3"
            style="vertical-align: bottom;width:3.5rem;">
            <el-option v-for="item in filterSaveTypes" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div style="text-align: right;margin-top:0.1rem;line-height:0.8rem;">
        <el-button size="small" @click="cancelFilter">重 置</el-button>
        <el-button type="primary" size="small"
          @click="filterManySensor(filterManyForm.sgroup_id,filterManyForm.sensorKey,filterManyForm.show_type,filterManyForm.save_type,filterManyForm.report_type)">查
          询</el-button>
      </div>
    </div>
  </div>
</template>

<script>
  import ChannelInfo from './ChannelInfo.vue';
  import SlaveInfo from './SlaveInfo.vue';
  import SensorSetList from './SensorSetList.vue';
  //import Test from './Test.vue';
  //import FormulaCreater from '../templates/FormulaCreater.vue';
  //import FormulaInfo from '../templates/FormulaInfo.vue';
  import configData from '../common.js';
  export default {
    name: 'slave',
    data() {
      return {
        //当屏幕小于1360时，控制元素影藏；
        win: window,
        screen_1360: false,
        one: 1,
        zero: 0,
        hasScroll:false,
        //fromPage:'',
        tokenTimer: null,
        stateTimer: null,
        isAll: false,
        chooseArray: [],
        //isGetSensor:true,
        formLabelWidth: '2.2rem', //2.5
        formLabelWidth2: '3.6rem', //4.2
        formLabelWidth3: '1.8rem', //4.2
        close: false,
        canSet: false,
        showChannel: true,
        whichOne: '',
        whatName: '',
        whatText: '',
        tableHead: localStorage.getItem("bgcolor"),
        slavesCount: localStorage.getItem("slavesCount"),
        addFormVisible: false,
        editFormVisible: false,
        dialogInfoVisible: false,
        oneUpdateVisible: false,
        manyUpdateVisible: false,
        manyFilterVisible: false,
        formulaInfoVisible: false,
        stateWidth: 60,
        channelSlaves: [],
        treeSlaveId: 0,
        channelName: '',
        channelInfo: {
          channel_type: '',
          channel_mode: 0,
          channel_config: {

          }
        },
        //isOn: 0,
        isExam: false,
        Socket: null,
        wsUrl: this.$wssUrl,
        timer: null,
        channelTip: '(默认显示首个端口的信息和首个子设备的数据点,点击切换)',
        slaveInfo: {
          channel_type: '',
          channel: {
            channel_type: ''
          },
          slave_config: {

          }
        },
        slaveTip: '(点击子设备可切换信息和右侧对应数据点)',
        protocols: [],
        protocols_485: configData.protocols_485,
        protocols_PLC: configData.protocols_PLC,
        protocols_ethernet: configData.protocols_ethernet,
        protocols_local: configData.protocols_local,
        channels: configData.channels,
        baudRates: configData.baudRates,
        dataBits: [{
            value: 8,
            label: 8
          },
          {
            value: 7,
            label: 7
          }
        ],
        stopBits: [{
          value: 1,
          label: 1
        }, {
          value: 2,
          label: 2
        }],
        parities: configData.parities,
        speeds: configData.speeds,
        channelForm: {
          channel_type: 'com1',
          channel_mode: 0,
          channel_config: {}
          //slave_protocol: "modbus_rtu_master",
          //report_interval:60
        },
        editChannelForm: {
          id: 0,
          channel_type: '',
          channel_mode: 0,
          comConfig: {},
          //report_interval:60,
          rs485Config: {},
          ethernetConfig: {},
          loraConfig: {},
          zigbeeConfig: {},
          localConfig: {},
          channel_config: {}
          //slave_protocol: "",
        },
        rs485Config: configData.rs485Config,
        ethernetConfig: configData.ethernetConfig,
        loraConfig: configData.loraConfig,
        zigbeeConfig: configData.zigbeeConfig,
        localConfig: configData.localConfig,
        comConfig: configData.comConfig,
        timeoutOptions: configData.timeoutOptions,
        channelModes: [{
            value: 0,
            label: '边缘采集'
          },
          {
            value: 1,
            label: '数据透传'
          }
        ],
        // queryParams: {
        // 	pageNo: 1,
        // 	pageSize: 10,
        // 	total: 0
        // },
        //tabledata: [],
        screenWidth: 1920,
        //复制子设备
        slaves:[],
        copySlaveVisible:false,
        copySlaveForm:{
           equip_id:'',
           channel_id:'',
           id:'',
           old_slave_name:'',
           slave_name:'',
           slave_no:'',
           slave_addr:''
        },
        //子设备添加编辑相关数
        addSlaveForm: {
          name: '子设备1', //
          num: 'slave1',
          //template: '',
          slave_protocol: '',
          channel: '',
          channel_type:'',
          slave_addr: 1 //西门子2，modbus为1
        },
        channelWord: '',
        //端口的简写：
        shortChannel: '',
        //协议的简写
        shortProtocol: '',
        slaveChannels: [],
        localChannels:[],
        localEthernetChannels:[],
        addSlaveFormVisible: false,
        editSlaveFormVisible: false,
        moulds: [],
        //modbus_master
        modbusMaster: configData.modbusMaster,
        modbusClient: configData.modbusClient,
        modbusSlave: configData.modbusSlave,
        localSlave: configData.localSlave,
        localSlave54:configData.localSlave54,
        s7_200_ppi: configData.s7_200_ppi,
        dl_T645: configData.dl_T645,
        //s7_200_smart，s7-1200,s7-1500协议配置参数相同
        s7_1200_1500: configData.s7_1200_1500,
        //三菱fx串口系列协议参数
        fx_serial_port: configData.fx_serial_port,
        cmds_16: configData.cmds_16,
        orders_16: configData.orders_16,
        orders_32: configData.orders_32,
        orders_64: configData.orders_64,
        crc_modes: configData.crc_modes,
        //local下除ethernet端口外，做了从站就不能同时再做主站
        hasSlaveModel:0,
        //编辑相关数据点；
        slaveId: 0,
        editProtocol: '',
        editSlaveForm: {
          name: '',
          num: '',
          sensors_count: 0,
          channel: '',
          slave_addr: ''
        },
        editModbusMaster: {
          ...configData.modbusMaster
        },
        editModbusClient: {
          ...configData.modbusClient
        },
        editModbusSlave: {
          ...configData.modbusSlave
        },
        editLocalSlave: {
          response_delay: 10 //响应延时时间
        },
        editS7_200_ppi: {
          ...configData.s7_200_ppi
        },
        editDL_T645: {
          ...configData.dl_T645
        },
        //s7-200_smart,s7-1200,s7-1500配置参数相同
        editS7_1200_1500: {
          ...configData.s7_1200_1500
        },
        //三菱fx串口协议参数
        editFx_serial_port: {
          ...configData.fx_serial_port
        },
        infoShow: 'channel',
        defaultChannelId: 0,
        defaultChannelLabel: '',
        //以下是数据点相关
        dialogFormVisible_4: false,
        copyTem: {
          template_name: '',
          remark: ''
        },
        whileIfs: configData.whileIfs,
        waterMarks: configData.waterMarks,
        slaveName: '',
        slaveProtocol: '',
        baseurl: this.$baseurl,
        //more: true,
        //more_2: true,
        dialogFormVisible_2: false,
        dialogFormVisible_3: false,
        templateId: 0,
        only: false,
        // copyForm: {
        //     num: 1
        // },
        // deviceData: {
        //   firmware_version: ""
        // },
        changeName: false,
        addForm: {
          channel_type: '',
          slave_name: '',
          slave_protocol: '',
          slave_id: 0,
        },
        addRealForm: {
          boxNum: 1,
          sign_0: '00',
          sign_1: '00',
          sign_2: '00',
          sign_3: '00',
          data_channel: '0',
          first_key: 0,
          number: 1,
          step: 1,
          sensor_name: '',
          sgroup_id: 0,
          show_type: 1,
          value_type: 0,
          //read_write: 1, //1只读，2读写
          save_type: 2, //1存储，2不存储，3变化存储
          data_key: '',
          value_key: '',
          unit: '',
          //standard_max:'',
          //standard_min:'',
          min_value: 0,
          max_value: 65535,
          mark: 0,
          //ext_vars:'',
          report_type: 0,
          decimals: 0,
          list_order: 0,
          magnification: 1,
          value_offset: 0,
          threshold: 1,
          icon: 'static/images/icon/icon1.png',
          is_virtual: 0
        },
        drawerShow: false,
        filterText: '',
        sensorTree: [],
        sensorString: '',
        addVirtualForm: {
          sensor_name: '',
          sgroup_id: 0,
          show_type: 1,
          save_type: 2, //1存储，2不存储，3变化存储
          data_key: '',
          unit: '',
          report_type: 0,
          decimals: 0,
          list_order: 0,
          magnification: 1,
          value_offset: 0,
          threshold: 0,
          icon: 'static/images/icon/icon1.png',
          is_virtual: 1,
          formula: ''
        },

        editForm: {
          id: 0,
          sensor_name: '',
          sgroup_id: 0,
          show_type: 1,
          //read_write: 1, //1只读，2读写
          save_type: 2, //1存储，2不存储，3变化存储
          data_key: '',
          value_key: '',
          value_type: 0,
          magnification: 1,
          value_offset: 0,
          threshold: 1,
          unit: '',
          //standard_max:'',
          //standard_min:'',
          min_value: 0,
          max_value: 65535,
          mark: 0,
          //ext_vars:'',
          report_type: 0,
          decimals: 0,
          list_order: '',
          icon: 'static/images/icon/icon1.png',
          is_virtual: 0,
          formula: ''
        },

        whiches: [{
            value: 'magnification',
            label: '倍数'
          },
          {
            value: 'value_offset',
            label: '偏置'
          },
          {
            value: 'decimals',
            label: '小数位'
          },
          {
            value: 'threshold',
            label: '阈值'
          },
          {
            value: 'report_type',
            label: '数据属性'
          },
          {
            value: 'unit',
            label: '单位'
          },
          {
            value: 'show_type',
            label: '读写/显示'
          },
          {
            value: 'save_type',
            label: '存储'
          },
          {
            value: 'sgroup_id',
            label: '所属分组'
          }
        ],
        editManyForm: {
          edit_which: 'magnification',
          show_type: 1,
          save_type: 2, //1存储，2不存储，3变化存储
          magnification: 1,
          value_offset: 0,
          threshold: 1,
          unit: '',
          report_type: 0,
          decimals: 0,
          sgroup_id: 0
        },
        filterManyForm: {
          sensor_name: '',
          sgroup_id: '',
          show_type: '',
          save_type: '', //1存储，2不存储，3变化存储
          report_type: ''
        },
        filterGroups: [{
          value: '',
          label: '全部'
        }],
        filterShowTypes: [{
          value: '',
          label: '全部'
        }],
        filterSaveTypes: [{
          value: '',
          label: '全部'
        }],
        filterReportTypes: [{
          value: '',
          label: '全部'
        }],
        direction: 'ltr',
        isFilter: false,
        //copyitem: {},
        dialogFormVisible: false,
        domains: [],
        domainIndex: '',
        domains2: [],
        loading: false,
        dataChannels: [],
        //modbus系列数据通道是一样的；
        addSensor_modbus: configData.addSensor_modbus,
        //s7_200_smart和s7_200_ppi数据通道是一样的；
        addSensor_s7200: configData.addSensor_s7200,
        //s7_1200和s7_1500数据通道是一样的；
        addSensor_1200_1500: configData.addSensor_1200_1500,
        //两个三菱fx协议数据通道是一样的；
        addSensor_mitsubishi_fx: configData.addSensor_mitsubishi_fx,
        //数据属性选项
        reportTypes: configData.reportTypes,
        reportTypes_54: configData.reportTypes_54,
        //存储选项
        saves: configData.saves,
        //读写/显示选项
        options: configData.options,
        //批量修改时的读写/显示选项
        updateManyOptions: configData.options,
        //小数点选项
        points: configData.points,
        //三菱fx协议参数协议格式选项
        famtterFxs: configData.famtterFxs,
        //三菱fx协议参数是否效验选项
        checkFxs: configData.checkFxs,
        //i,q区数值类型一样
        valueTypes_IQ: configData.valueTypes_IQ,
        //m,v,db区数值类型一样
        valueTypes_MV: configData.valueTypes_MV,
        //modBus的0区1区数值类型只有布尔型
        valueTypes_01: configData.valueTypes_01,
        //modBus的3区4区数值类型
        valueTypes_34: configData.valueTypes_34,
        //T645协议数值类型
        valueTypes_T645: configData.valueTypes_T645,
        //两个三菱fx协议D区数值类型
        valueTypes_Fx_D: configData.valueTypes_Fx_D,
        valueTypes: [],
        //版本号转小数的方法
        //versionToFloat:configData.versionToFloat,
        max: '',
        setForm: {
          template_name: 0,
          sgroup_id: 0
        },
        moulds: [{
          value: 0,
          label: '无'
        }],
        //分组管理相关变量
        tabledata: [],
        queryParams: {
          pageNo: 1,
          pageSize: 5,
          total: 0
        },
        groups: [{
          value: 0,
          label: '暂不分组'
        }],
        formLabelWidth3: '50px', //2.5
        dialogVisible: false,
        teamListVisible: false,
        teamAddVisible: false,
        teamEditVisible: false,
        addTeamForm: {
          sgroup_name: '',
          list_order: 1
          //sgroup_icon:'',
          //sgroup_desc:''
        },
        editTeamForm: {
          id: 0,
          sgroup_name: '',
          list_order: 1
          //sgroup_icon:'',
          //sgroup_desc:''
        }
        // authId: 0,
        // authData: [],
        // transferData: [],
        // transferValue: [],
        // auth: false,
        // valData: []
      }
    },
    components: {
      ChannelInfo,
      SlaveInfo,
      SensorSetList
      //Test
      //FormulaCreater
      //FormulaInfo
    },
    props: ['deviceData','isOn','isRead'],

    watch: {
      filterText(val) {
        this.$refs.tree.filter(val);
      }
    },

    // beforeRouteEnter (to, from, next) {
    //     next(vm => {
    // 	   vm.$data.fromPage=from.name;
    // 	   //console.log(vm.$data.fromPage);
    //     })
    // },


    created() {
      //this.deviceData = this.$props.deviceData;
      if (this.deviceData.version>=3) {
        this.channels = configData.channels_53;
      }
      this.isOn = Number(this.deviceData.is_on);
      this.getChannel(this.deviceData.id);
      this.reFreshData();
      //this.getTemplate();
      this.getTeamAll(this.deviceData.id);
      //console.log(this.modbusMaster);
      //localStorage.setItem('lookData', JSON.stringify(this.deviceData));

    },

    mounted() {
      var that = this;
      this.$refs.page.style.height = window.innerHeight + 'px';
      this.getToken();
      this.tokenTimer = setInterval(function() {
        that.getToken();
      }, 10200000);
      this.screenWidth = window.screen.width || 1920;
      if (this.screenWidth <= 1366) {
        this.formLabelWidth2 = "4.2rem";
        this.formLabelWidth = "3rem";
        this.screen_1360 = true;
      }
      if (localStorage.getItem("operType") == 'send') {
        this.isOn = 0;
        this.$parent.$parent.$parent.isOn=0;
        this.stateTimer = setTimeout(function() {
          that.getState(that.deviceData.id);
        }, 50000);
      }
      setTimeout(function(){
         that.hasScroll = that.hasVerticalScroll(that.$refs.slave);
      },1000)
    },

    methods: {
      handleCommand(command) {
      	var that = this;
      	switch (command) {
      		case 'group':
      			this.showList(this.queryParams.pageNo,this.queryParams.pageSize);
      			break;
      		case 'virtual':
      			this.addSensors('virtual');
      			break;
      		case 'filter':
      			this.filterMany();
      			break;
      		case 'update':
      			this.updateMany();
      			break;
      		case 'delete':
      			this.deleteMany();
      			break;
      	}
      },

      //判断元素是否出现滚动条
      hasVerticalScroll(element) {
        return element.scrollHeight > element.clientHeight;
      },
      //全选或取消全选的函数；
      //this.chooseArray为已选择数据点的id数组；
      //isAll为是否全选，默认false;
      chooseAll(e) {
        this.isAll = !this.isAll;
        for (let i = 0, len = this.domains.length; i < len; i++) {
          this.domains[i].check = this.isAll;
          if (this.isAll) {
            this.chooseArray.push(this.domains[i].id);
          }
        }
        if (!this.isAll) {
          this.chooseArray = [];
        }
      },

      //选中当前一个或取消的函数；
      //check为每个数据点的是否选中属性，默认false;
      chooseOne(index) {
        this.domains[index].check = !this.domains[index].check;
        if (this.domains[index].check) {
          this.chooseArray.push(this.domains[index].id);
        } else {
          for (let i = 0, len = this.chooseArray.length; i < len; i++) {
            if (this.chooseArray[i] == this.domains[index].id) {
              this.chooseArray.splice(i, 1);
            }
          }
        }
        this.isAll = this.chooseArray.length == this.domains.length ? true : false;
      },

      refreshState(id) {
        var that = this;
        this.$http({
          method: 'post',
          url: 'api/equip/online',
          data: {
            'id': id
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.isOn = Number(res.data.data.is_on);
            this.$parent.$parent.$parent.isOn= Number(res.data.data.is_on);
            localStorage.removeItem("operType");
            this.$notify({
              title: '状态提示:',
              message: that.isOn == 1 ? '当前设备已在线,状态已更新！' : '当前设备已离线,状态已更新,部分操作将无法使用！',
              duration: 3000,
              position: 'bottom-left',
              offset: 20
            });
          }

        }).catch(error => {
          console.log(error);
        });

      },

      async getState(id) {
        await this.refreshState(id);
        this.getVersion(id);
      },

      getVersion(id) {
        this.$http({
          method: 'post',
          url: 'api/equip/info',
          data: {
            "id": id
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            for(let key in this.deviceData){
               this.deviceData[key]=res.data.data[key];
            }
            //this.deviceData.firmware_version = res.data.data.firmware_version;
          }
        }).catch(error => {
          console.log(error);
        });
      },

      async getChannelTree() {
        this.channelSlaves = [];
        this.slaveName = '';
        //this.slaveId = 0;
        var num = 0;
        await this.$http({
          method: 'post',
          url: 'api/channel/tree',
          data: {
            'equip_id': this.deviceData.id

          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.channelSlaves = res.data.data;
            if (this.channelSlaves.length) {
              this.channelName = this.channelSlaves[0].label;
              this.defaultChannelLabel = this.channelToUpper(this.channelSlaves[0].label);
              this.defaultChannelId = res.data.data[0].id;
              this.getChannelInfo(res.data.data[0].id);
              for (let i = 0, len = this.channelSlaves.length; i < len; i++) {
                this.channelSlaves[i].index = i + 1;
              }
              for (let n = 0, len2 = this.channelSlaves.length; n < len2; n++) {
                if (this.channelSlaves[n].children.length) {
                  num = 1;
                  this.slaveName = this.editSlaveForm.name ? this.editSlaveForm.name : this.channelSlaves[n]
                    .children[0].label;
                  this.slaveId = this.channelSlaves[n].children[0].id;
                  this.slaveProtocol = this.channelSlaves[n].children[0].slave_protocol;
                  break;
                }
              }
              if (!num) {
                this.slaveId = 0;
                this.domains = [];
              }

            }
            //return true;
          } else {
            return 0;
          }
        }).catch(error => {
          console.log(error);
          return false;
        });
      },

      async onlyGetChannelTree() {
        await this.$http({
          method: 'post',
          url: 'api/channel/tree',
          data: {
            'equip_id': this.deviceData.id

          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.channelSlaves = res.data.data;
            if (this.channelSlaves.length == 1 && this.channelSlaves[0].children.length == 1) {
              this.reFreshData();
            }
            //console.log(this.channelSlaves);
            return true;
          } else {
            return 0;
          }
        }).catch(error => {
          console.log(error);
          return false;
        });

      },

      async reFreshData() {
        await this.getChannelTree();
        if (this.slaveId) {
          this.getSensor(this.slaveId);
          this.getSlaveShowInfo(this.slaveId);
        }
      },

      async edit(node, data) {
        if (node.level == 1) {
          //端口修改函数
          event.stopPropagation();
          this.editChannelForm.id = data.id
          this.editChannelForm.channel_type = data.label;
          if (this.deviceData.version >= 3) {
            this.editChannelForm.channel_mode = data.channel_mode;
          }
          this.editFormVisible = true;
          await this.getChannelInfo(data.id);
          this.modifyChannel(this.channelInfo);
        } else {
          //子设备修改函数；
          this.slaveId = data.id;
          this.preModifySlave(data.id);
        }
      },

      remove(node, data) {
        event.stopPropagation();
        if (node.level == 1) {
          //删除端口函数
          this.sureDeleteChannel(data.id, data.children.length);
        } else {
          //console.log(data.label);
          console.log(data);
          //删除子设备函数；
          this.sureDeleteSlave(data.id, data.label);
        }
      },

      getInfo(node, data) {
        var that = this;
        if (node.level == 1) {
          //端口详情函数
          this.infoShow = "channel";
          this.getChannelInfo(data.id);
          this.defaultChannelId = data.id;
          this.defaultChannelLabel = this.channelToUpper(data.label);
        } else {
          this.infoShow = "slave";
          this.manyFilterVisible = false;
          //子设备详情函数；
          this.getSlaveShowInfo(data.id);
          if (this.slaveName != data.label) {
            this.isExam = false;
            if (this.Socket) {
              clearInterval(that.timer);
              this.Socket.close();
            }
            this.slaveName = data.label;
            this.slaveId = data.id;
            this.getSensor(data.id);
            this.setForm.template_name = 0;
          } else if (this.slaveName == data.label && this.isFilter) {
            this.slaveId = data.id;
            this.getSensor(data.id);
            this.isFilter = false;
          }
        }
      },

      preAddChannel() {
        this.addFormVisible = true;
        // if (this.deviceData.version == 2) {
        //   this.channelForm.channel_type = 'rs';
        //   this.rs485Config = Object.assign({}, configData.rs485Config);
        // } else if (this.deviceData.version == 3) {
          this.channelForm.channel_type = 'com1';
          this.channelForm.channel_mode = 0;
          this.comConfig = Object.assign({}, configData.comConfig);
        //}
        //this.channelForm.report_interval=60;
        //默认为485，显示对应协议
        this.protocols = this.protocols_485;
      },

      addChannel() {
        var that = this;
        if (this.channelForm.channel_type.indexOf('rs') >= 0) {
          this.channelForm.channel_config = this.rs485Config;
        } else if (this.channelForm.channel_type.indexOf('com') == 0) {
          this.channelForm.channel_config = this.comConfig;
        } else if (this.channelForm.channel_type.indexOf('thernet') >= 0) {
          this.channelForm.channel_config = this.ethernetConfig;
        } else if (this.channelForm.channel_type.indexOf('ora') >= 0) {
          this.channelForm.channel_config = this.loraConfig;
        } else if (this.channelForm.channel_type.indexOf('igbee') >= 0) {
          this.channelForm.channel_config = this.zigbeeConfig;
        } else if (this.channelForm.channel_type.indexOf('ocal') >= 0) {
          this.channelForm.channel_config = this.localConfig;
        }

        this.$http({
          method: 'post',
          url: 'api/channel/add',
          data: !(this.deviceData.version==4 && this.channelForm.channel_type.indexOf('ernet')>=0)? {
            'equip_id': this.deviceData.id,
            'channel_type': this.channelForm.channel_type,
            'channel_mode': this.channelForm.channel_mode,
            'channel_config': this.channelForm.channel_config
          } : {
            'equip_id': this.deviceData.id,
            'channel_type': this.channelForm.channel_type,
            'channel_config': this.channelForm.channel_config
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '恭喜,添加端口成功!',
              duration: 2000,
              type: 'success',
              center: true
            });
            this.getChannel(this.deviceData.id);
            this.onlyGetChannelTree();
            this.addFormVisible = false;
          }
        }).catch(error => {
          console.log(error);
        });

      },

      changeChannel(type) {
        this.rs485Config = Object.assign({}, configData.rs485Config);
        this.comConfig = Object.assign({}, configData.comConfig);
        this.loraConfig = Object.assign({}, configData.loraConfig);
        this.zigbeeConfig = Object.assign({}, configData.zigbeeConfig);
        this.ethernetConfig = Object.assign({}, configData.ethernetConfig);
        this.localConfig = Object.assign({}, configData.localConfig);
      },

      modifyChannel(row) {
        //console.log(row);
        // this.editFormVisible = true;
        // this.editChannelForm.id = row.id;
        // this.editChannelForm.channel_type = row.channel_type;
        this.editChannelForm.channel_mode = row.channel_mode;
        if (this.editChannelForm.channel_type.indexOf('rs') >= 0) {
          this.editChannelForm.rs485Config = Object.assign({}, row.channel_config);
          switch (row.channel_config.parity) {
            case 'None':
              this.editChannelForm.rs485Config.parity = 0;
              break;
            case 'Odd':
              this.editChannelForm.rs485Config.parity = 1;
              break;
            case 'Even':
              this.editChannelForm.rs485Config.parity = 2;
              break;
          }

        } else if (this.editChannelForm.channel_type.indexOf('com') == 0) {
          this.editChannelForm.comConfig = Object.assign({}, row.channel_config);
          switch (row.channel_config.parity) {
            case 'None':
              this.editChannelForm.comConfig.parity = 0;
              break;
            case 'Odd':
              this.editChannelForm.comConfig.parity = 1;
              break;
            case 'Even':
              this.editChannelForm.comConfig.parity = 2;
              break;
          }
        } else if (this.editChannelForm.channel_type.indexOf('thernet') >= 0) {
          this.editChannelForm.ethernetConfig = Object.assign({}, row.channel_config);
        } else if (this.editChannelForm.channel_type.indexOf('ora') >= 0) {
          this.editChannelForm.loraConfig = Object.assign({}, row.channel_config);
        } else if (this.editChannelForm.channel_type.indexOf('igbee') >= 0) {
          this.editChannelForm.zigbeeConfig = Object.assign({}, row.channel_config);
        } else if (this.editChannelForm.channel_type.indexOf('ocal') >= 0) {
          this.editChannelForm.localConfig = Object.assign({}, row.channel_config);
        }

      },

      updateChannel(type,channel) {
        if (this.editChannelForm.channel_type.indexOf('rs') >= 0) {
          this.editChannelForm.channel_config = this.editChannelForm.rs485Config;
          //console.log(this.editChannelForm.rs485Config);
        } else if (this.editChannelForm.channel_type.indexOf('com') == 0) {
          this.editChannelForm.channel_config = this.editChannelForm.comConfig;
        } else if (this.editChannelForm.channel_type.indexOf('thernet') >= 0) {
          this.editChannelForm.channel_config = this.editChannelForm.ethernetConfig;
        } else if (this.editChannelForm.channel_type.indexOf('ora') >= 0) {
          this.editChannelForm.channel_config = this.editChannelForm.loraConfig;
        } else if (this.editChannelForm.channel_type.indexOf('igbee') >= 0) {
          this.editChannelForm.channel_config = this.editChannelForm.zigbeeConfig;
        } else if (this.editChannelForm.channel_type.indexOf('ocal') >= 0) {
          this.editChannelForm.channel_config = this.editChannelForm.localConfig;
        }
        this.$http({
          method: 'post',
          url: type == 'sure' ? 'api/channel/update' : 'api/channel/remoteSet',
          data: !(this.deviceData.version==4 && this.editChannelForm.channel_type.indexOf('ernet')>=0)? {
            'id': this.editChannelForm.id,
            'equip_id': this.deviceData.id,
            'channel_type': this.editChannelForm.channel_type,
            'channel_mode': this.editChannelForm.channel_mode,
            'channel_config': this.editChannelForm.channel_config
          } : {
            'id': this.editChannelForm.id,
            'equip_id': this.deviceData.id,
            'channel_type': this.editChannelForm.channel_type,
            'channel_config': this.editChannelForm.channel_config
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            if(channel.indexOf('thernet')>=0 && type=="live"){
            	this.$message({
            	  message: 'Ethernet端口更新需要重启,请稍等大约40秒左右!',
            	  type: 'info',
            	  duration: 2000,
            	  center: true
            	});
            	this.isOn=0;
            	this.$parent.$parent.$parent.isOn=0;
            	setTimeout(function() {
            	  that.canSet = false;
            	  that.getState(that.deviceData.id);
            	}, 42000);
            }else{
            	this.$message({
            	  message: '更新端口成功!',
            	  type: 'success',
            	  duration: 2000,
            	  center: true
            	});
            }
            this.getChannel(this.deviceData.id);
            this.getChannelInfo(this.editChannelForm.id);
            this.editFormVisible = false;
          }
        }).catch(error => {
          console.log(error);
        });
      },

      //判断local下添加、编辑子设备时，从机模式对应端口不能同时既做主站又做从站
      changeSlaveModel(channel,value){
      		//console.log(channel,value);
      		if(channel.indexOf('thernet')<=0 && value==1){
            for(let i=0,len=this.channelSlaves.length;i<len;i++){
      				if(channel==this.channelSlaves[i].label && this.channelSlaves[i].children.length){
                this.hasSlaveModel++;
      					this.$message({
      					  message: this.channelToUpper(channel)+'不能既做主站又做从站!',
      					  duration: 3000,
      					  type: 'error',
      					  center: true
      					});
      					break;
      				}
      		    }
      		}else {
      			if(this.hasSlaveModel>0){
      			   this.hasSlaveModel--
      			}
      		}
      },

      sureDeleteChannel(id, num) {
        this.$confirm('删除后可能会引起设备连接故障,删除后无法恢复,是否确认删除?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.deleteChannel(id, num);
        }).catch(() => {
          //               this.$message({
          //                   type: 'info',
          // duration:2000,
          //                   message: '已取消删除'
          //               });
        });
      },

      getChild() {
        //$emit触发事件
        this.$refs.sensorList.$emit("testChild");
        console.log("a");
      },

      fatherMethod() {
        console.log("这是父组件");
      },

       deleteChannel(id, num) {
        var that = this;
        this.$http({
          method: 'post',
          url: 'api/channel/delete',
          data: {
            "id": id

          }
        }).then(async res => {
          if (res && res.data.result == "success") {
            this.channelInfo = {};
            this.getChannel(this.deviceData.id);
            if (num) { //有子设备刷新全部，无子设备只刷新左边树
              this.reFreshData();
            } else {
            await  this.onlyGetChannelTree();
              if (this.infoShow == "channel") {
                this.getChannelInfo(this.defaultChannelId);
              }
            }
          }
        }).catch(error => {
          console.log(error);
        });
      },

      getChannel(id) {
        var that = this;
        this.slaveChannels = [];
        //local使能端口
        this.localChannels = [];
        this.localEthernetChannels=[];
        this.$http({
          method: 'post',
          url: 'api/channel/all',
          data: {
            'equip_id': id

          }
        }).then(res => {
          if (res && res.data.result == "success") {

            if (res.data.data.length) {
              for (let i = 0; i < res.data.data.length; i++) {
                let thisLabel=this.channelToUpper(res.data.data[i].channel_type);
                let channel = {
                  value: res.data.data[i].id,
                  label: thisLabel,
                }

                this.slaveChannels.push(channel);
                if(this.deviceData.version==4){
                  if(res.data.data[i].channel_type.indexOf('ocal')<0 && res.data.data[i].channel_type.indexOf('ora')<0){
                    this.localChannels.push({
                        value:res.data.data[i].id,
                        formItem:res.data.data[i].channel_type,
                        label:that.channelToUpper(res.data.data[i].channel_type)+'从机模式'
                    })

                    this.$set(this.localSlave54,res.data.data[i].channel_type,0);
                    if(res.data.data[i].channel_type.indexOf('ernet')>=0){
                        this.localEthernetChannels.push({
                            value:res.data.data[i].id,
                            formItem:res.data.data[i].channel_type+'_port',
                            label:that.channelToUpper(res.data.data[i].channel_type)+'端口'
                        })
                        this.$set(this.localSlave54,res.data.data[i].channel_type+'_port',502);
                    }
                  }

                }
              }
              //console.log(this.localChannels);
              //console.log(this.localEthernetChannels);

            }
          }
        }).catch(error => {
          console.log(error);
        });
      },
      //异步改同步请求；
      async getChannelInfo(id) {
        await this.$http({
          method: 'post',
          url: 'api/channel/info',
          data: {
            'id': id

          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.channelInfo = res.data.data;
            if (res.data.data.channel_config.dhcp && res.data.data.channel_config.dhcp !== null && res.data.data
              .channel_config.dhcp !== undefined) {
              this.channelInfo.channel_config.dhcp = Number(res.data.data.channel_config.dhcp);
            }
            this.channelInfo.channel_type = res.data.data.channel_type ? res.data.data.channel_type :
              '';
            if (res.data.data.channel_type && res.data.data.channel_type.indexOf('thernet') == -1 &&
              res.data.data.channel_type
              .indexOf('ocal') == -1) {
              if (res.data.data.channel_config.parity == 0) {
                this.channelInfo.channel_config.parity = 'None';
              } else if (res.data.data.channel_config.parity == 1) {
                this.channelInfo.channel_config.parity = 'Odd';
              } else if (res.data.data.channel_config.parity == 2) {
                this.channelInfo.channel_config.parity = 'Even';
              }
            }
            return true;
          }
        }).catch(error => {
          console.log(error);
        });
      },

      sureDeleteSlave(id, label) {
        this.$confirm('删除后该子设备将消失,相关数据也将清除,删除后无法恢复,是否确认删除?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.handleClick(id, label);
        }).catch(() => {
          //               this.$message({
          //                   type: 'info',
          // duration:2000,
          //                   message: '已取消删除'
          //               });
        });
      },

      handleClick(id, label) {
        var that = this;
        this.$http({
          method: 'post',
          url: 'api/slave/delete',
          data: {
            "id": id

          }
        }).then(res => {
          if (res && res.data.result == "success") {
            if (label != this.slaveName) {
              this.onlyGetChannelTree();
              if (this.infoShow == "slave") {
                this.getSlaveShowInfo(this.slaveId);
              }
            } else {
              this.reFreshData();
            }
          }
        }).catch(error => {
          console.log(error);
        });
      },
      //添加子设备相关函数
      preAddSlave() {
        //this.getTemplate();
        this.addSlaveFormVisible = true;
        this.addSlaveForm.channel = this.defaultChannelId ? this.defaultChannelId : this.slaveChannels[0].value;
        this.addSlaveForm.name = '子设备1';
        //console.log(this.defaultChannelId,this.defaultChannelLabel);
        this.channelWord = this.defaultChannelLabel ? this.defaultChannelLabel : this.slaveChannels[0].label;
        this.addSlaveForm.channel_type=this.channelWord.toLowerCase();
        //端口的简写：
        this.shortChannel = '';
        //协议的简写
        this.shortProtocol = '';
        //子设备键名不设置，不显示
        //console.log(this.slaveChannels);
        if (this.channelWord.indexOf('485') >= 0) {
          this.protocols = this.protocols_485;
          this.shortChannel = "";
        } else if (this.channelWord.indexOf('COM') == 0) {
          this.protocols = this.protocols_485;
          this.shortChannel = "Com";
        } else if (this.channelWord.indexOf('232') >= 0) {
          this.protocols = this.protocols_485;
          this.shortChannel = "232_";
        } else if (this.channelWord.indexOf('thernet') >= 0) {
          this.protocols = this.protocols_ethernet;
          this.shortChannel = "";
        } else if (this.channelWord.indexOf('oRa') >= 0) {
          this.protocols = this.protocols_485;
          this.shortChannel = "LoRa_";
        } else if (this.channelWord.indexOf('igbee') >= 0) {
          this.protocols = this.protocols_485;
          this.shortChannel = "Zig_";
        } else if (this.channelWord.indexOf('ocal') >= 0) {
          this.protocols = this.protocols_local;
          this.shortChannel = "Local";
        }
        this.addSlaveForm.slave_protocol = this.protocols[0].value;
        //第一个协议不会出现T645,所以这里不判断
        if (this.addSlaveForm.slave_protocol.indexOf('s7') >= 0) {
          this.addSlaveForm.slave_addr = 2;
          this.s7_1200_1500.server_ip = "192.168.2.1";
        } else {
          this.addSlaveForm.slave_addr = 1;
        }
        this.changeAddProtocol(this.addSlaveForm.slave_protocol);

      },

      changeAddProtocol(protocol) {
        this.s7_200_ppi.state_reg.ping_address = "VW0";
        this.s7_200_ppi.state_reg.state_address = "VW2";
        this.s7_1200_1500.state_reg.ping_address = "DB1.DB0.0";
        this.s7_1200_1500.state_reg.state_address = "DB1.DB0.1";
        if (this.addSlaveForm.slave_protocol.indexOf('rtu_master') >= 0) {
          this.shortProtocol = 'Slave';
        } else if (this.addSlaveForm.slave_protocol.indexOf('ascii') >= 0) {
          this.shortProtocol = 'Slave';
        } else if (this.addSlaveForm.slave_protocol.indexOf('lient') >= 0) {
          this.shortProtocol = 'Server';
        } else if (this.addSlaveForm.slave_protocol.indexOf('ver') >= 0) {
          this.shortProtocol = 'Server';
        } else if (this.addSlaveForm.slave_protocol == 'modbus') {
          this.shortProtocol = '';
        } else if (this.addSlaveForm.slave_protocol.indexOf('pi') >= 0) {
          this.shortProtocol = 'S7_200PLC';
        } else if (this.addSlaveForm.slave_protocol.indexOf('1997') >= 0) {
          this.shortProtocol = '645_97_';
        } else if (this.addSlaveForm.slave_protocol.indexOf('2007') >= 0) {
          this.shortProtocol = '645_07_';
        } else if (this.addSlaveForm.slave_protocol.indexOf('rogram') >= 0) {
          this.s7_200_ppi.state_reg.ping_address = "D0000";
          this.s7_200_ppi.state_reg.state_address = "D0001";
          this.shortProtocol = 'Slave';
        } else if (this.addSlaveForm.slave_protocol.indexOf('erial') >= 0) {
          this.shortProtocol = 'Slave';
        } else if (this.addSlaveForm.slave_protocol.indexOf('mart') >= 0) {
          this.s7_1200_1500.state_reg.ping_address = "VW0";
          this.s7_1200_1500.state_reg.state_address = "VW2";
          this.shortProtocol = 'S7_SmartPLC';
        } else if (this.addSlaveForm.slave_protocol.toLowerCase() == 's7_200') {
          this.s7_1200_1500.state_reg.ping_address = "VW0";
          this.s7_1200_1500.state_reg.state_address = "VW2";
          this.shortProtocol = 'S7_200PLC';
        } else if (this.addSlaveForm.slave_protocol.indexOf('1200') >= 0) {
          this.shortProtocol = 'S7_1200PLC';
        } else if (this.addSlaveForm.slave_protocol.indexOf('300') >= 0) {
          this.shortProtocol = 'S7_300/400PLC';
        } else if (this.addSlaveForm.slave_protocol.indexOf('1500') >= 0) {
          this.shortProtocol = 'S7_1500PLC';
        }

        if (this.addSlaveForm.slave_protocol.indexOf('s7') >= 0) {
          this.addSlaveForm.slave_addr = 2;
          this.s7_1200_1500.server_ip = "192.168.2.1";
        } else if (this.addSlaveForm.slave_protocol.indexOf('645') >= 0) {
          this.addSlaveForm.slave_addr = "000000691889";
        } else {
          this.addSlaveForm.slave_addr = 1;
        }
        if (this.channelWord.indexOf('thernet') >= 0) {
          this.addSlaveForm.num = this.shortChannel + this.shortProtocol + '1';
        } else if (this.channelWord.indexOf('ocal') >= 0) {
          this.addSlaveForm.num = this.shortChannel;
        } else if (this.addSlaveForm.slave_protocol.indexOf('645') >= 0) {
          this.addSlaveForm.num = this.shortChannel + this.shortProtocol + this.addSlaveForm.slave_addr.substr(this
            .addSlaveForm.slave_addr.length - 3, 3);
        } else {
          this.addSlaveForm.num = this.shortChannel + this.shortProtocol + this.addSlaveForm.slave_addr;
        }
        this.$forceUpdate();
      },

      changeAddSlaveChannel(channel) {
        //console.log(channel)
        var nowChannel = "";
        for (var i = 0, len = this.slaveChannels.length; i < len; i++) {
          if (this.slaveChannels[i].value == channel) {
            nowChannel = this.slaveChannels[i].label;
            this.channelWord = this.slaveChannels[i].label;
            this.addSlaveForm.channel_type=this.slaveChannels[i].label.toLowerCase();
            if (nowChannel.indexOf('485') >= 0) {
              this.protocols = this.protocols_485;
              this.shortChannel = "";
            } else if (nowChannel.indexOf('COM')>= 0) {
              this.protocols = this.protocols_485;
              this.shortChannel = "Com";
            } else if (nowChannel.indexOf('232') >= 0) {
              this.protocols = this.protocols_485;
              this.shortChannel = "232_";
            } else if (nowChannel.indexOf('thernet') >= 0) {
              this.protocols = this.protocols_ethernet;
              this.shortChannel = "";
            } else if (nowChannel.indexOf('oRa') >= 0) {
              this.protocols = this.protocols_485;
              this.shortChannel = "LoRa_";
            } else if (nowChannel.indexOf('igbee') >= 0) {
              this.protocols = this.protocols_485;
              this.shortChannel = "Zig_";
            } else if (nowChannel.indexOf('ocal') >= 0) {
              this.protocols = this.protocols_local;
              this.shortChannel = "Local";
            }
            this.addSlaveForm.slave_protocol = this.protocols[0].value;
            //第一个协议不会出现T645,所以这里不判断
            if (this.addSlaveForm.slave_protocol.indexOf('s7') >= 0) {
              this.addSlaveForm.slave_addr = 2;
              this.s7_1200_1500.server_ip = "192.168.2.1";
            } else {
              this.addSlaveForm.slave_addr = 1;
            }
            this.$forceUpdate();
            this.changeAddProtocol(this.addSlaveForm.slave_protocol);
            break;
          }
        }

      },

      changeAddAddr() {
        if (this.channelWord.indexOf('thernet') >= 0) {
          this.addSlaveForm.num = this.shortChannel + this.shortProtocol + '1';
        } else if (this.channelWord.indexOf('ocal') >= 0) {
          this.addSlaveForm.num = this.shortChannel;
        } else if (this.addSlaveForm.slave_protocol.indexOf('645') >= 0) {
          this.addSlaveForm.num = this.shortChannel + this.shortProtocol + this.addSlaveForm.slave_addr.substr(this
            .addSlaveForm.slave_addr.length - 3, 3);
        } else {
          this.addSlaveForm.num = this.shortChannel + this.shortProtocol + this.addSlaveForm.slave_addr;

        }
      },

      argmentInfo() {
        this.dialogInfoVisible = true;
      },

      getTemplate() {
        var that = this;
        that.moulds = [{
          value: 0,
          label: '无'
        }];
        this.$http({
          method: 'post',
          url: 'api/template/all',
          data: {
            'version': 2
          }
        }).then(res => {
          //console.log(res.data)
          if (res && res.data.result == "success") {

            for (let i = 0; i < res.data.data.length; i++) {
              let mould = {
                value: res.data.data[i].id,
                label: res.data.data[i].template_name
              }
              that.moulds.push(mould);
            }
            that.setForm.template_name = that.moulds[0].value;
            that.addSlaveForm.template = that.moulds[0].value;
          }
        }).catch(error => {
          console.log(error);
        });
      },

      addSlave() {
        var that = this;
        if(this.hasSlaveModel>0){
        	this.$message({
        	  message: '同一端口不能既做主站又做从站!',
        	  duration: 3000,
        	  type: 'error',
        	  center: true
        	});
        	return;
        }

        var channel = this.addSlaveForm.channel_type;
        for(let i=0,len=this.channelSlaves.length;i<len;i++){
        	if(this.channelSlaves[i].label=="local"){
        		if(this.channelSlaves[i].children.length && this.channelSlaves[i].children[0].slave_config[channel]==1){
        			this.$message({
        			  message:this.channelToUpper(channel)+'在Local下从站模式已打开,不能再做主站!',
        			  duration: 3000,
        			  type: 'error',
        			  center: true
        			});
        			return;
        		}
        		break;
        	}
        }
        var slaveConfig = {
          state_reg: null
        };
        if (this.addSlaveForm.slave_protocol.indexOf('rtu_master') >= 0) {
          slaveConfig = Object.assign({}, that.modbusMaster);
        } else if (this.addSlaveForm.slave_protocol.indexOf('ascii') >= 0) {
          slaveConfig = Object.assign({}, that.modbusMaster);
        } else if (this.addSlaveForm.slave_protocol.indexOf('lient') >= 0 || this.addSlaveForm.slave_protocol.indexOf(
            'ver') >= 0) {
          slaveConfig = Object.assign({}, that.modbusClient);
          // } else if (this.addSlaveForm.slave_protocol.indexOf('rtu_slave') >= 0) {
          // 	slaveConfig = Object.assign({}, this.modbusSlave);
        } else if (this.addSlaveForm.slave_protocol == 'modbus') {
          if(this.deviceData.version==3){
             slaveConfig = Object.assign({}, that.localSlave);
          }else if(this.deviceData.version==4){
            slaveConfig = Object.assign({}, that.localSlave54);
          }
        } else if (this.addSlaveForm.slave_protocol.indexOf('pi') >= 0 || this.addSlaveForm.slave_protocol.indexOf(
            'rogram') >= 0) {
          slaveConfig = Object.assign({}, that.s7_200_ppi);
        } else if (this.addSlaveForm.slave_protocol.indexOf('645') >= 0) {
          slaveConfig = Object.assign({}, that.dl_T645);
        } else if (this.addSlaveForm.slave_protocol.indexOf('mart') >= 0 || this.addSlaveForm.slave_protocol
          .indexOf('1200') >= 0 || this.addSlaveForm.slave_protocol.indexOf('1500') >= 0 || this.addSlaveForm
          .slave_protocol.indexOf('300') >= 0 || this.addSlaveForm.slave_protocol.toLowerCase() == 's7_200') {
          slaveConfig = Object.assign({}, that.s7_1200_1500);

        } else if (this.addSlaveForm.slave_protocol.indexOf('erial') >= 0) {
          slaveConfig = Object.assign({}, that.fx_serial_port);
          // } else if (this.addSlaveForm.slave_protocol.indexOf('rtu_slave') >= 0) {
          // 	slaveConfig = Object.assign({}, this.modbusSlave);
        }

        if(this.deviceData.version==4){
          delete slaveConfig.state_reg
        }

         this.$http({
          method: 'post',
          url: 'api/slave/add',
          data: {
            "equip_id": this.deviceData.id,
            "slave_name": this.addSlaveForm.name,
            "slave_protocol": this.addSlaveForm.slave_protocol,
            "channel_id": this.addSlaveForm.channel,
            "slave_no": this.addSlaveForm.num,
            "slave_addr": this.addSlaveForm.slave_addr,
            "slave_config": slaveConfig

          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '恭喜,添加子设备成功!',
              duration: 2000,
              type: 'success',
              center: true
            });
            this.deviceData.slaves_count++;
            this.onlyGetChannelTree();
            // if(this.slaveId){
            // 	this.getSensor(this.slaveId);
            // 	this.getSlaveShowInfo(this.slaveId);
            // }
            this.addSlaveFormVisible = false;
          }
          //console.log("charu")
        }).catch(error => {

          console.log(error);
        });
      },


      changeEditProtocol(protocol) {
        if (this.editProtocol.indexOf('rtu_master') >= 0 || this.editProtocol.indexOf('ascii') >= 0) {
          this.shortProtocol = 'Slave';
        } else if (this.editProtocol.indexOf('lient') >= 0) {
          this.shortProtocol = 'Server';
        } else if (this.editProtocol.indexOf('ver') >= 0) {
          this.shortProtocol = 'Server';
        } else if (this.editProtocol == 'modbus') {
          this.shortProtocol = '';
        } else if (this.editProtocol.indexOf('pi') >= 0) {
          this.shortProtocol = 'S7_200PLC';
        } else if (this.editProtocol.indexOf('1997') >= 0) {
          this.shortProtocol = '645_97_';
        } else if (this.editProtocol.indexOf('2007') >= 0) {
          this.shortProtocol = '645_07_';
        } else if (this.editProtocol.indexOf('rogram') >= 0) {
          this.shortProtocol = 'Slave';
        } else if (this.editProtocol.indexOf('erial') >= 0) {
          this.shortProtocol = 'Slave';
        } else if (this.editProtocol.indexOf('mart') >= 0) {
          this.shortProtocol = 'S7_SmartPLC';
        } else if (this.editProtocol.toLowerCase() == 's7_200') {
          this.shortProtocol = 'S7_200PLC';
        } else if (this.editProtocol.indexOf('1200') >= 0) {
          this.shortProtocol = 'S7-1200PLC';
        } else if (this.editProtocol.indexOf('300') >= 0) {
          this.shortProtocol = 'S7_300/400PLC';
        } else if (this.editProtocol.indexOf('1500') >= 0) {
          this.shortProtocol = 'S7_1500PLC';
        }

        if (this.editProtocol.indexOf('s7') >= 0) {
          this.editSlaveForm.slave_addr = 2;
          this.editS7_1200_1500.server_ip = "192.168.2.1";
        } else if (this.editProtocol.indexOf('645') >= 0) {
          this.editSlaveForm.slave_addr = "000000691889";
        } else {
          this.editSlaveForm.slave_addr = 1;
        }
        if (this.channelWord.indexOf('thernet') >= 0) {
          this.editSlaveForm.num = this.shortChannel + this.shortProtocol + '1';
        } else if (this.channelWord.indexOf('ocal') >= 0) {
          this.editSlaveForm.num = this.shortChannel;
        } else if (this.editProtocol.indexOf('645') >= 0) {
          this.editSlaveForm.num = this.shortChannel + this.shortProtocol + this.editSlaveForm.slave_addr.substr(this
            .editSlaveForm.slave_addr.length - 3, 3);
        } else {
          this.editSlaveForm.num = this.shortChannel + this.shortProtocol + this.editSlaveForm.slave_addr;

        }
      },

      changeEditAddr() {
        if (this.channelWord.indexOf('thernet') >= 0) {
          this.editSlaveForm.num = this.shortChannel + this.shortProtocol + '1';
        } else if (this.channelWord.indexOf('ocal') >= 0) {
          this.editSlaveForm.num = this.shortChannel;
        } else if (this.editProtocol.indexOf('645') >= 0) {
          this.editSlaveForm.num = this.shortChannel + this.shortProtocol + this.editSlaveForm.slave_addr.substr(this
            .editSlaveForm.slave_addr.length - 3, 3);
        } else {
          this.editSlaveForm.num = this.shortChannel + this.shortProtocol + this.editSlaveForm.slave_addr;

        }
      },

      getSlaveShowInfo(id) {
        this.$http({
          method: 'post',
          url: 'api/slave/info',
          data: {
            "id": id

          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.slaveInfo = res.data.data;
            this.slaveInfo.channel = res.data.data.channel;
            //为了组件复用，重新赋值；
            this.slaveInfo.channel_type = res.data.data.channel.channel_type;
            if (res.data.data.slave_config.write16_cmd != null && res.data.data.slave_config
              .write16_cmd != undefined) {
              this.slaveInfo.slave_config.write16_cmd = res.data.data.slave_config.write16_cmd == 0 ?
                '0x06' : '0x10';
            }
            if (res.data.data.slave_config.int16_order != null && res.data.data.slave_config
              .int16_order != undefined) {
              this.slaveInfo.slave_config.int16_order = res.data.data.slave_config.int16_order == 0 ?
                'AB' : 'BA';
            }
            if (res.data.data.slave_config.crc_mode != null && res.data.data.slave_config.crc_mode !=
              undefined) {
              this.slaveInfo.slave_config.crc_mode = res.data.data.slave_config.crc_mode == 0 ?
                'LH' : 'HL';
            }
            switch (Number(res.data.data.slave_config.int32_order)) {
              case 0:
                this.slaveInfo.slave_config.int32_order = 'ABCD';
                break;
              case 1:
                this.slaveInfo.slave_config.int32_order = 'CDAB';
                break;
              case 2:
                this.slaveInfo.slave_config.int32_order = 'BADC';
                break;
              case 3:
                this.slaveInfo.slave_config.int32_order = 'DCBA';
                break;
            }
            switch (Number(res.data.data.slave_config.float_order)) {
              case 0:
                this.slaveInfo.slave_config.float_order = 'ABCD';
                break;
              case 1:
                this.slaveInfo.slave_config.float_order = 'CDAB';
                break;
              case 2:
                this.slaveInfo.slave_config.float_order = 'BADC';
                break;
              case 3:
                this.slaveInfo.slave_config.float_order = 'DCBA';
                break;
            }
            switch (Number(res.data.data.slave_config.int64_order)) {
              case 0:
                this.slaveInfo.slave_config.int64_order = 'ABCDEFGH';
                break;
              case 1:
                this.slaveInfo.slave_config.int64_order = 'GHEFCDAB';
                break;
              case 2:
                this.slaveInfo.slave_config.int64_order = 'BADCFEHG';
                break;
              case 3:
                this.slaveInfo.slave_config.int64_order = 'KGFEDCBA';
                break;
            }
            switch (Number(res.data.data.slave_config.double_order)) {
              case 0:
                this.slaveInfo.slave_config.double_order = 'ABCDEFGH';
                break;
              case 1:
                this.slaveInfo.slave_config.double_order = 'GHEFCDAB';
                break;
              case 2:
                this.slaveInfo.slave_config.double_order = 'BADCFEHG';
                break;
              case 3:
                this.slaveInfo.slave_config.double_order = 'KGFEDCBA';
                break;
            }

          }

        }).catch(error => {
          console.log(error);

        });
      },

      getSlaveInfo(id) {
        //var nowChannel = "";
        this.$http({
          method: 'post',
          url: 'api/slave/info',
          data: {
            "id": id

          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.editSlaveForm.name = res.data.data.slave_name;
            this.editSlaveForm.num = res.data.data.slave_no;
            this.editProtocol = res.data.data.slave_protocol;
            this.editSlaveForm.slave_addr = res.data.data.slave_addr;
            this.editSlaveForm.sensors_count = res.data.data.sensors_count;
            this.editSlaveForm.channel = res.data.data.channel_id;
            if (this.slaveChannels.length && (!res.data.data.channel_id)) {
              this.$message({
                message: '该子设备尚未选择端口，请先选择端口!',
                type: 'error',
                duration: 2000,
                center: true
              });
              return false
            }
            for (let i = 0, len = this.slaveChannels.length; i < len; i++) {
              if (this.slaveChannels[i].value == this.editSlaveForm.channel) {
                var nowChannel = this.slaveChannels[i].label;
                this.channelWord = this.slaveChannels[i].label;
                if (nowChannel.indexOf('485') >= 0) {
                  this.protocols = this.protocols_485;
                  this.shortChannel = "";
                } else if (nowChannel.indexOf('Com') == 0) {
                  this.protocols = this.protocols_485;
                  this.shortChannel = "Com";
                } else if (nowChannel.indexOf('232') >= 0) {
                  this.protocols = this.protocols_485;
                  this.shortChannel = "232_";
                } else if (nowChannel.indexOf('thernet') >= 0) {
                  this.protocols = this.protocols_ethernet;
                  this.shortChannel = "";
                } else if (nowChannel.indexOf('oRa') >= 0) {
                  this.protocols = this.protocols_485;
                  this.shortChannel = "LoRa_";
                } else if (nowChannel.indexOf('igbee') >= 0) {
                  this.protocols = this.protocols_485;
                  this.shortChannel = "Zig_";
                } else if (nowChannel.indexOf('ocal') >= 0) {
                  this.protocols = this.protocols_local;
                  this.shortChannel = "Local";
                }
                break;
              }
            }
            //console.log(this.editProtocol)
            if (this.editProtocol && (this.editProtocol.indexOf('rtu_master') >= 0 || this.editProtocol.indexOf(
                'ascii') >= 0)) {
              this.editModbusMaster = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'Slave';
            } else if (this.editProtocol && (this.editProtocol.indexOf('lient') >= 0)) {
              this.editModbusClient = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'Server';
            } else if (this.editProtocol && this.editProtocol.indexOf('ver') >= 0) {
              this.editModbusClient = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'Server';
            } else if (this.editProtocol && this.editProtocol == 'modbus') {
              this.editLocalSlave = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = '';
            } else if (this.editProtocol && this.editProtocol.indexOf('pi') >= 0) {
              this.editS7_200_ppi = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'S7_200PLC';
            } else if (this.editProtocol && this.editProtocol.indexOf('1997') >= 0) {
              this.editDL_T645 = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = '645_97_';
            } else if (this.editProtocol && this.editProtocol.indexOf('2007') >= 0) {
              this.editDL_T645 = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = '645_07_';
            } else if (this.editProtocol && this.editProtocol.indexOf('rogram') >= 0) {
              this.editS7_200_ppi = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'Slave';
            } else if (this.editProtocol && this.editProtocol.indexOf('erial') >= 0) {
              this.editFx_serial_port = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'Slave';
            } else if (this.editProtocol && (this.editProtocol.indexOf('mart') >= 0)) {
              this.editS7_1200_1500 = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'S7_SmartPLC';
            } else if (this.editProtocol && (this.editProtocol.toLowerCase() == 's7_200')) {
              this.editS7_1200_1500 = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'S7_200PLC';
            } else if (this.editProtocol && (this.editProtocol.indexOf('1200') >= 0)) {
              this.editS7_1200_1500 = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'S7_1200PLC';
            } else if (this.editProtocol && (this.editProtocol.indexOf('300') >= 0)) {
              this.editS7_1200_1500 = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'S7_300/400PLC';
            } else if (this.editProtocol && (this.editProtocol.indexOf('1500') >= 0)) {
              this.editS7_1200_1500 = Object.assign({}, res.data.data.slave_config);
              this.shortProtocol = 'S7_1500PLC';
            }
          }

        }).catch(error => {
          console.log(error);

        });
      },

      preModifySlave(id) {
        var that = this;
        this.getSlaveInfo(id);
        this.slaveId = id;
        this.editSlaveFormVisible = true;

      },

      modifySlave() {
        var that = this;
        if(this.hasSlaveModel>0){
        	this.$message({
        	  message: '同一端口不能既做主站又做从站!',
        	  duration: 3000,
        	  type: 'error',
        	  center: true
        	});
        	return;
        }
        var slaveConfig = {};
        if (this.editProtocol.indexOf('rtu_master') >= 0 || this.editProtocol.indexOf('ascii') >= 0) {
          slaveConfig = Object.assign({}, this.editModbusMaster);
        } else if (this.editProtocol.indexOf('lient') >= 0 || this.editProtocol.indexOf('ver') >= 0) {
          slaveConfig = Object.assign({}, this.editModbusClient);
          // } else if (this.editProtocol.indexOf('rtu_slave') >= 0) {
          // 	slaveConfig = Object.assign({}, this.editModbusSlave);
        } else if (this.editProtocol == 'modbus') {
          slaveConfig = Object.assign({}, this.editLocalSlave);
        } else if (this.editProtocol.indexOf('pi') >= 0 || this.editProtocol.indexOf('rogram') >= 0) {
          slaveConfig = Object.assign({}, this.editS7_200_ppi);
        } else if (this.editProtocol.indexOf('645') >= 0) {
          slaveConfig = Object.assign({}, this.editDL_T645);
        } else if (this.editProtocol.indexOf('mart') >= 0 || this.editProtocol.indexOf('1200') >= 0 || this
          .editProtocol.indexOf('1500') >= 0 || this.editProtocol.indexOf('300') >= 0 || this.editProtocol
        .toLowerCase() == 's7_200') {
          slaveConfig = Object.assign({}, this.editS7_1200_1500);
        } else if (this.editProtocol.indexOf('erial') >= 0) {
          slaveConfig = Object.assign({}, this.editFx_serial_port);
        }

        if(this.deviceData.version==4){
           delete slaveConfig.state_reg;
        }

        this.$http({
          method: 'post',
          url: 'api/slave/update',
          data: {
            "equip_id": this.deviceData.id,
            "slave_name": this.editSlaveForm.name,
            "slave_no": this.editSlaveForm.num,
            "slave_addr": this.editSlaveForm.slave_addr,
            "channel_id": this.editSlaveForm.channel,
            "slave_protocol": this.editProtocol,
            "slave_config": slaveConfig,
            "id": this.slaveId

          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '恭喜,修改子设备成功!',
              type: 'success',
              duration: 2000,
              center: true
            });
            this.editSlaveFormVisible = false;
            this.getSlaveShowInfo(this.slaveId);
            this.getChannelTree();
            setTimeout(function() {
              that.editSlaveForm.name = '';
            }, 500);
          }
        }).catch(error => {
          this.editSlaveFormVisible = false;
          this.editSlaveForm.name = '';
          console.log(error);
        });
      },

      cancelEditSlave() {
        this.editSlaveFormVisible = false;
        this.editSlaveForm.name = '';
      },

      copySlave(node,data){
        console.log(this.channelToUpper(node.parent.data.label));
        var that=this;
        this.copySlaveVisible = true;
        this.copySlaveForm={
            equip_id:that.deviceData.id,
            channel_id:data.channel_id,
            id:data.id,
            old_slave_name:data.label,
            old_channel_name:that.channelToUpper(node.parent.data.label),
            slave_name:'',
            slave_no:'',
            slave_addr:''
        };
        this.getSlave(this.deviceData.id,data.id)
      },
      //暂时只有复制设备用到
      getSlave(id,slaveId){
        var that = this;
        this.slaves=[];
        this.$http({
          method: 'post',
          url: 'api/slave/all',
          data: {
            "equip_id":id
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            for(let i=0,len=res.data.data.length;i<len;i++){
              let slave={
                 value:res.data.data[i].id,
                 label:res.data.data[i].slave_name,
                 slave_no:res.data.data[i].slave_no,
                 slave_addr:res.data.data[i].slave_addr

              }
              this.slaves.push(slave);
              if(res.data.data[i].id==slaveId){
                 this.copySlaveForm.slave_addr=Number(res.data.data[i].slave_addr)+1;
                 this.copySlaveForm.slave_no=res.data.data[i].slave_no+'_copy';
              }
            }

          }
        }).catch(error => {

          console.log(error);
        });
      },

      changeCopySlave(id){
        var oldChannel = this.copySlaveForm.old_channel_name;
        var nowChannel = ''
        for(let i=0,len=this.slaveChannels.length;i<len;i++){
          if(id==this.slaveChannels[i].value){
            nowChannel = this.channelToUpper(this.slaveChannels[i].label);
            if(oldChannel.indexOf("COM")>=0 || oldChannel.indexOf("igbee")>=0 || oldChannel.indexOf("LoRa")>=0){
              if(nowChannel.indexOf('ernet')>=0 || nowChannel.indexOf('ocal')>=0){
                this.$message({
                  message: '由于对应协议及参数不同，不支持复制到当前端口下!',
                  type: 'error',
                  duration: 3000,
                  offset: 100,
                  center: true
                })
                return false;
              }else{
                return true;
              }
            }else if(oldChannel.indexOf("ernet")>=0 && nowChannel.indexOf('ernet')<0){
              this.$message({
                message: '当前只能复制到同类Ethernet端口下!',
                type: 'error',
                duration: 2000,
                offset: 100,
                center: true
              })
              return false;
            }else{
              return true;
            }
            break;
          }
        }

            // if(this.slaveChannels[i].label.indexOf('ernet')>=0 || this.slaveChannels[i].label.indexOf('ocal')>=0){
            //    this.slaveChannels[i].disabled = true;
            // }else if()
        // else if(){

        // }


      },

      async sureCopySlave(){
         var that = this;
         let canCopy =await this.changeCopySlave(this.copySlaveForm.channel_id);
         if(!this.copySlaveForm.slave_name){
            this.$message({
              message: '子设备名称不能为空!',
              type: 'error',
              duration: 2000,
              offset: 300,
              center: true
            });
            return
         }
         if(!this.copySlaveForm.slave_no){
            this.$message({
              message: '子设备ID不能为空!',
              type: 'error',
              duration: 2000,
              offset: 300,
              center: true
            });
            return
         }
         if(!this.copySlaveForm.slave_addr){
            this.$message({
              message: '子设备站号不能为空!',
              type: 'error',
              duration: 2000,
              offset: 300,
              center: true
            });
            return
         }
         if(canCopy){
           delete this.copySlaveForm.old_slave_name;
           delete this.copySlaveForm.old_channel_name;
           this.$http({
             method: 'post',
             url: 'api/slave/copy',
             data: this.copySlaveForm
           }).then(res => {
             if (res && res.data.result == "success") {
               this.copySlaveVisible = false;
               this.onlyGetChannelTree();
               this.getSlave(this.deviceData.id,this.copySlaveForm.id);
               this.$message({
                 message: '恭喜,复制子设备成功!',
                 type: 'success',
                 duration: 2000,
                 offset: 300,
                 center: true
               });

             }else{
               this.copySlaveVisible = false;
             }
           }).catch(error => {
             this.copySlaveVisible = false;
             console.log(error);
           });

        }else{
          console.log("不支持的复制");
        }
      },

      sendSet() {
        if (this.isExam) {
          this.cancelConnect();
        }
        this.$confirm('下发成功后将覆盖设备现有配置且无法还原, 是否确认下发?(如果使用了数据点模板,请先保存后下发!)', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.sureSendSet();
        }).catch(() => {
          //               this.$message({
          //                   type: 'info',
          // duration:2000,
          // offset:300,
          //                   message: '已取消下发配置'
          //               });
        });
      },

      //下发配置函数
      sureSendSet() {
        var that = this;
        this.canSet = true;
        this.loading = true;
        this.$http({
          method: 'post',
          url: 'api/equip/remoteConfig',
          data: {
            "id": this.deviceData.id
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.loading = false;
            //this.isLookData();
            this.$message({
              message: '恭喜,下发配置成功!',
              type: 'success',
              duration: 2000,
              offset: 300,
              center: true
            });
            this.isOn=0;
            this.$parent.$parent.$parent.isOn=0;
            setTimeout(function() {
              that.canSet = false;
              that.getState(that.deviceData.id);
            }, 60000);
          } else {
            this.loading = false;
            this.canSet = false;
          }
        }).catch(error => {
          this.loading = false;
          this.canSet = false;
          console.log(error);
        });
      },

      //数据点相关
      tobottom() {
        var content = document.getElementById("oneBox");
        content.scrollTop = content.scrollHeight;
      },

      readSet() {
        if (this.isExam) {
          this.cancelConnect();
        }
        this.$emit('goRead',true);
        // this.$router.push({
        //   name: 'slaveRead',
        //   path: '/slaveRead',
        //   component: 'slaveRead'
        // })
      },

      sendTemplate() {
        this.dialogFormVisible_4 = true;
        this.copyTem = {
          template_name: '',
          remark: ''
        };
      },

      connectSensors(id) {
        var that = this;
        this.Socket = new WebSocket(this.wsUrl);
        if (this.Socket.readyState != WebSocket.OPEN) {
          this.Socket.onopen = function() {
            var pingData = {
              action: "debug",
              data: {
                equip_id: that.deviceData.id,
                user_id: localStorage.getItem('at_userId'),
                slave_id: id,
                token: localStorage.getItem("attoken")
              }
            };

            that.Socket.send(JSON.stringify(pingData));
            //console.log(that.Socket);
            //readyState常量值的含义：
            //0 (CONNECTING)  正在链接中;
            //1 (OPEN) 已经链接并且可以通讯;
            //2 (CLOSING) 连接正在关闭;
            //3 (CLOSED) 连接已关闭或者没有链接成功;
            if (that.Socket.readyState == 1) {
              that.$message({
                message: '数据通信成功!',
                type: 'success',
                offset: 300,
                duration: 2000,
                center: true
              });
            } else if (that.Socket.readyState == 3) {
              that.$message({
                message: '数据通信失败,无法建立连接或连接已关闭!',
                type: 'error',
                offset: 300,
                duration: 2000,
                center: true
              });
            }
            that.refreshDataAll();
            that.timer = setInterval(function() {
              that.Socket.send(JSON.stringify(pingData));
            }, 30000);
            console.log('连接成功')
          };
        };
        this.Socket.onerror = this.onError;
        this.Socket.onmessage = this.onMessage;
      },

      refreshDataAll() {
        var that = this;
        this.$http({
          method: 'post',
          url: 'api/equip/refresh',
          data: {
            "id": this.deviceData.id,
            "mode": 'all'
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            console.log("数据刷新成功")
          }
        }).catch(error => {
          console.log(error);
        });
      },

      onError(e) {
        // this.$message({
        // 	message: '数据通信失败，正在尝试再次连接!',
        // 	type: 'info',
        // 	duration:3000,
        // 	offset:300,
        // 	center: true
        // });
        this.Socket.onopen();
      },

      isObject(obj) {
        return obj.constructor.toString().indexOf("Object") > -1;
      },
      onMessage(msg) {
        var that = this;
        var messageData = JSON.parse(msg.data);
        if (messageData.result == "success" && this.isObject(messageData.data)) {
          var liveDatas = messageData.data;
          if (liveDatas.equip) {
            that.isOn = Number(liveDatas.equip.is_on);
            that.$parent.$parent.$parent.isOn=Number(liveDatas.equip.is_on);
            // that.equipInfo.is_on = liveDatas.equip.is_on == 1 ? '在线' : '离线';
            // that.equipInfo.is_alarm = liveDatas.equip.is_alarm == 1 ? '是' : '否';
            // that.equipInfo.last_data_time = liveDatas.equip.last_data_time;
            if (liveDatas.equip && liveDatas.equip.is_on != 1) {
              that.$notify({
                title: '警告',
                message: '当前设备连接中断,若为设备重启将马上恢复,否则请检查设备连接!',
                type: 'warning',
                duration: 6000,
                offset: 150
              });
              for (let i = 0, len = that.domains.length; i < len; i++) {
                that.domains[i].value = '';
              }
            }
            that.$forceUpdate();
          }
          if (liveDatas.data && liveDatas.equip) {
            for (let i = 0, len = that.domains.length; i < len; i++) {
              for (let key in liveDatas.data) {
                if (that.domains[i].id == key) {
                  that.domains[i].value = liveDatas.data[key];
                  //that.domains[i].value = 'bad';
                }

              }
            }
          }
        } else {
          console.log(messageData.message);
        }
      },


      examConnect() {
        this.isExam = true;
        this.connectSensors(this.slaveId);
      },

      changeVal(item) {
        if (Number(item.show_type) % 2 != 0) {
          return
        }
        var that = this;
        this.$prompt('数据点名称:' + '<span style="color:deepskyblue;">' + item.sensor_name +
          '</span><br/><span style="color:red">如果设备正在使用,请确保该操作没有危险性！</span>', '写入测试', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            inputPattern: item.show_type == 2 ? /^-{0,1}\d+(\.\d+)?$/ : /^[0|1]$/,
            dangerouslyUseHTMLString: true,
            inputPlaceholder: item.value,
            inputErrorMessage: item.show_type == 2 ? '设值错误，值必须为数字！' : '非数值变量请使用0/1值！'
          }).then(({
          value
        }) => {
          if (value) {
            this.$http({
              method: 'post',
              url: 'api/sensor/write',
              data: {
                "id": item.id,
                "value": value

              }
            }).then(res => {
              if (res && res.data.result == "success") {

                that.$message({
                  message: '写入数据点成功!',
                  type: 'success',
                  offset: 300,
                  center: true
                });
              }
              // console.log(that.pointdata[0].icon)
            }).catch(error => {
              console.log(error);
            });
          } else {
            this.$message({
              type: 'error',
              offset: 300,
              message: '写入失败，修改值不能为空！',
              center: true
            });
          }

        }).catch(() => {
          this.$message({
            type: 'info',
            message: '取消写入!'
          });

        });
      },

      cancelConnect() {
        var that = this;
        this.isExam = false;
        for (let i = 0, len = this.domains.length; i < len; i++) {
          this.domains[i].value = '';
        }
        clearInterval(that.timer);
        this.Socket.close();
        console.log('已关闭连接');
      },

      copyTemplate() {
        this.$http({
          method: 'post',
          url: 'api/slave/exportToTemplate',
          data: {

            "id": this.slaveId,
            "template_name": this.copyTem.template_name,
            "remark": this.copyTem.remark
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '恭喜,导出配置为模板成功!',
              type: 'success',
              duration: 2000,
              offset: 300,
              center: true
            });
            this.getTemplate();
          }

        }).catch(error => {
          console.log(error);

        });
        this.dialogFormVisible_4 = false;
      },

      getSensor(id, sgroup_id = '', keyword = '', show_type = '', save_type = '', report_type = '') {
        var that = this;
        this.domains = [];
        this.hasScroll = false;
        this.$http({
          method: 'post',
          url: 'api/sensor/all',
          data: {
            "slave_id": id,
            "sgroup_id": sgroup_id,
            "keyword": keyword,
            "show_type": show_type,
            "save_type": save_type,
            "report_type": report_type,
            "order": 'address'
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            //that.domains = res.data.data.sort(this.sortName('sensor_name'));
            that.domains = Array.from(res.data.data);
            let len = that.domains.length;

            //that.addForm.list_order=Number(that.domains[len-1].list_order)+1;
            for (let i = 0, len = res.data.data.length; i < len; i++) {
              that.domains[i] = res.data.data[i];
              that.$set(that.domains[i], 'value', '');
              that.$set(that.domains[i], 'check', false);
              that.$set(that.domains[i], 'visible', false);
              delete that.domains[i].sensor_code;
              if (res.data.data[i].show_type > 2) {
                that.domains[i].decimals = 0;
                that.domains[i].unit = '';
              }
              if (res.data.data[i].save_type == 1) {
                that.domains[i].save_type = '存储';
              } else if (res.data.data[i].save_type == 2) {
                that.domains[i].save_type = '不存储';
              } else if (res.data.data[i].save_type == 3) {
                that.domains[i].save_type = '变化存储';
              }
            }
            setTimeout(function(){
              that.hasScroll = that.hasVerticalScroll(that.$refs.slave);
            },500)
          }

        }).catch(error => {
          console.log(error);
          this.domains = [];
        });

      },

      copy(obj) {
        return Object.assign({}, obj);
        //return {...obj};//也可以用扩展运算符
      },

      getSensorInfo(id) {
        if (this.deviceData.app_scene == 1) {
          //             	delete this.editForm.min_value;
          //             	delete this.editForm.max_value;
          delete this.editForm.mark;
        }

        this.$http({
          method: 'post',
          url: 'api/sensor/info',
          data: {
            'id': id
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            for (var key in this.editForm) {
              this.editForm[key] = res.data.data[key]
            }
            this.editForm.show_type = Number(res.data.data.show_type);
            this.addressValueType(this.editForm.data_key);
          }
        }).catch(error => {
          console.log(error);

        });
      },

      async showSensor(index, id) {
        await this.getSensorInfo(id);
        //console.log(this.editForm);
        //删除引起错误的多余字段
        delete this.editForm.last_alarm;
        if (this.slaveInfo.slave_protocol.indexOf('645') < 0) {
          delete this.editForm.sign_0;
          delete this.editForm.sign_1;
          delete this.editForm.sign_2;
          delete this.editForm.sign_3;
        } else {
          this.valueTypes = this.valueTypes_T645;
        }

        if (this.editForm.show_type > 2) {
          this.editForm.decimals = 0;
          this.editForm.unit = '';
        }

        if (this.domains[index].save_type == '存储') {
          this.editForm.save_type = 1;
        } else if (this.domains[index].save_type == '不存储') {
          this.editForm.save_type = 2;
        } else if (this.domains[index].save_type == '变化存储') {
          this.editForm.save_type = 3;
        }
        return true;

      },

      async showUpdate(index, e, id) {
        var that = this;
        this.oper = "edit";
        this.drawerShow = false;
        //this.sensorString = "";
        this.getTeamAll(this.deviceData.id);
        this.showSensor(index, id);
        this.getSlaveSensorTree(this.deviceData.id);
        setTimeout(function() {
          that.drawerShow = true;
        }, 500)

        this.dialogFormVisible_2 = true;
      },

      cancelUpdate() {
        //var that = this;
        this.dialogFormVisible_2 = false;
      },

      async updateOne(index, item, key, text) {
        this.whichOne = key;
        this.whatName = item.sensor_name;
        this.whatText = text;
        await this.showSensor(index, item.id);
        if (this.whichOne == 'sgroup_name') {
          this.getTeamAll(this.deviceData.id);
        }
        this.oneUpdateVisible = true;
      },

      cancelOneUpdate() {
        this.oneUpdateVisible = false;
      },

      changeAddType(type) {
        if (type > 2) {
          this.addForm.decimals = 0;
          this.addForm.unit = '';
          this.addForm.threshold = 1;
        } else {
          this.addForm.threshold = 0;
        }
      },

      changeAddDecimal(decimal, magnification) {
        if (this.addForm.slave_protocol.indexOf('645') >= 0) {
          var initMagn = 1;
          if (Number.isInteger(Number(magnification))) {
            initMagn = Number(magnification);
          } else {
            initMagn = Number(magnification.toString().split('.')[1]);
          }
          this.addForm.magnification = initMagn / (10 ** Number(decimal));
        }
      },

      changeEditType(type) {
        if (type > 2) {
          this.editForm.decimals = 0;
          this.editForm.unit = '';
          this.editForm.threshold = 1;
        } else {
          this.editForm.threshold = 0;
        }
      },

      changeEditDecimal(decimal, magnification) {
        if (this.slaveInfo.slave_protocol.indexOf('645') >= 0) {
          var initMagn = 1;
          if (Number.isInteger(Number(magnification))) {
            initMagn = Number(magnification);
          } else {
            initMagn = Number(magnification.toString().split('.')[1]);
          }
          this.editForm.magnification = initMagn / (10 ** Number(decimal));
        }
      },

      changeReportAdd() {
        if (this.addForm.report_type == 1) {
          this.addForm.save_type = 2;
        }
      },
      changeReportEdit() {
        if (this.editForm.report_type == 1) {
          this.editForm.save_type = 2;
        }
      },

      changeReportType(type,oper){
          if(oper=="add"){
            if(type==3){
              this.addForm.show_type=1;
              this.addForm.save_type=2;
            }else if(type==4){
              this.addForm.show_type=2;
              this.addForm.save_type=2;
            }
          }else if(oper=="edit"){
            if(type==3){
              this.editForm.show_type=1;
              this.editForm.save_type=2;
            }else if(type==4){
              this.editForm.show_type=2;
              this.editForm.save_type=2;
            }
          }
      },

      getIndex(ind) {
        this.domainIndex = ind;
        this.domains[ind].visible = true;
        event.stopPropagation();
      },

      closePop() {
        if (this.domainIndex !== '') {
          this.domains[this.domainIndex].visible = false;
        }
      },

      chooseIcon(i, item) {
        var that = this;
        let iconurl = 'static/images/icon/icon' + i + '.png';
        for (var key in this.editForm) {
          this.editForm[key] = item[key];
        }
        this.editForm.icon = iconurl;
        item.icon = iconurl;
        if (item.save_type == '存储') {
          this.editForm.save_type = 1;
        } else if (item.save_type == '不存储') {
          this.editForm.save_type = 2;
        } else if (item.save_type == '变化存储') {
          this.editForm.save_type = 3;
        }
        this.updateHappen();
      },

      chooseIcon_1(event) {
        var that = this;
        let iconurl = 'static/images/icon/icon' + event.target.id + '.png';
        this.addForm.icon = iconurl;
        //this.addForm.visible = false;
        //document.getElementById(this.domainIndex).src=this.baseurl+iconurl;
      },

      goBack() {
        this.$router.go(-1);
      },

      goList() {
        //localStorage.removeItem("lookData");
        if (this.isExam) {
          this.cancelConnect();
        }
        this.$router.push({
          name: 'device',
          path: '/device',
          component: 'device'
        });
      },

      chooseIcon_2() {
        var that = this;
        let iconurl = 'static/images/icon/icon' + event.target.id + '.png';
        this.editForm.icon = iconurl;
        //this.editForm.visible = false;
      },

      cancelCopy() {
        this.dialogFormVisible_3 = false;
      },

      updateHappen() {
        var that = this;
        //this.editForm.visible = false;
        if (that.editForm.show_type > 2) {
          that.editForm.decimals = 0;
          that.editForm.unit = '';
        }
        this.$http({
          method: 'post',
          url: 'api/sensor/update',
          data: this.editForm
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '恭喜,修改数据点成功!',
              type: 'success',
              offset: 300,
              duration: 2000,
              center: true
            });
            this.dialogFormVisible_2 = false;
            this.oneUpdateVisible = false;
            if (!this.manyFilterVisible) {
              this.getSensor(this.slaveId);
            } else {
              this.getSensor(this.slaveId, this.filterManyForm.sgroup_id, this.filterManyForm.sensorKey, this
                .filterManyForm.show_type, this.filterManyForm.save_type, this.filterManyForm.report_type)
            }
            if (this.isAll) {
              this.chooseAll();
            }
          }
        }).catch(error => {
          console.log(error);

        });
      },

      sureDeleteSensor(item, e) {
        //e.currentTarget.parentElement.style.backgroundColor = "#ddd";
        this.$confirm('删除后无法恢复, 是否确认删除该数据点?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.removeDomain(item);
        }).catch(() => {
          //               this.$message({
          //                   type: 'info',
          // duration:2000,
          //                   message: '已取消删除'
          //               });
        });
      },

      removeDomain(item) {
        var that = this;
        this.$http({
          method: 'post',
          url: 'api/sensor/delete',
          data: {
            "id": item.id

          }
        }).then(res => {
          if (res && res.data.result == "success") {

            this.$message({
              message: '恭喜,删除数据点成功!',
              type: 'success',
              offset: 300,
              duration: 2000,
              center: true
            });
            if (!this.manyFilterVisible) {
              this.getSensor(this.slaveId);
            } else {
              this.getSensor(this.slaveId, this.filterManyForm.sgroup_id, this.filterManyForm.sensorKey, this
                .filterManyForm.show_type, this.filterManyForm.save_type, this.filterManyForm.report_type)
            }
            this.$emit('getDeviceInfo',this.deviceData.id);
            if (this.isAll) {
              this.chooseAll();
            }
          }
        }).catch(error => {
          console.log(error);

        });
      },

      //16制判断函数
      is16Fix(str, name) {
        var reg = /^[0-9A-Fa-f]{2}$/;
        if (str) {
          if (!reg.test(str)) {
            this.$message({
              message: '标识' + name + '格式错误,请重新输入!',
              type: 'error'
            })
            return false;
          } else {
            return true;
          }
        } else {
          this.$message({
            message: '标识' + name + '不能为空,请输入!',
            type: 'error'
          })
          return false;
        }
      },

      addHappen(isVirtual) {
        var that = this;
        this.addForm.slave_id = this.slaveId;
        if (isVirtual == 0) {
          if (this.addForm.slave_protocol.indexOf('2007') >= 0) {
            if (!this.is16Fix(this.addForm.sign_0, 'DI0') || !this.is16Fix(this.addForm.sign_1, 'DI1') || !this.is16Fix(
                this.addForm.sign_2, 'DI2') || !this.is16Fix(this.addForm.sign_3, 'DI3')) {
              return false;
            }
          } else if (this.addForm.slave_protocol.indexOf('1997') >= 0) {
            if (!this.is16Fix(this.addForm.sign_0, 'DI0') || !this.is16Fix(this.addForm.sign_1, 'DI1')) {
              return false;
            }
          }
          if (this.addForm.number > 100) {
            this.$message({
              type: 'error',
              offset: 300,
              message: '单次添加数量不得超过100个，请重设！',
              center: true
            })
            return false;
          }
          if (this.addForm.slave_protocol.indexOf('645') <= 0) {
            if (this.createFirstKey(this.addForm.slave_protocol, this.addForm.data_channel, this.addForm.value_type,
                this.addForm.first_key, this
                .addForm.boxNum) == "repeat") {
              this.$message({
                type: 'error',
                offset: 300,
                message: '此起始寻址将会使地址与现有数据点产生重复，请重设！',
                center: true
              })
              return false;
            }

          }
          delete this.addForm.step;
          delete this.addForm.data_channel;
          delete this.addForm.first_key;
          //delete this.addForm.slave_protocol;
          delete this.addForm.channel_type;
          delete this.addForm.slave_name;
          delete this.addForm.boxNum;
          // if(this.deviceData.app_scene!=3){
          // 	delete this.addForm.value_key;
          // }
        }
        this.$http({
          method: 'post',
          url: isVirtual == 0 ? 'api/sensor/batchAdd' : 'api/sensor/add',
          data: this.addForm
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: isVirtual == 0 ? '恭喜，添加数据点成功!' : '恭喜，添加虚拟数据点成功!',
              type: 'success',
              duration: 2000,
              offset: 300,
              center: true
            });
            if (!this.manyFilterVisible) {
              this.getSensor(this.slaveId);
            } else {
              this.getSensor(this.slaveId, this.filterManyForm.sgroup_id, this.filterManyForm.sensorKey, this
                .filterManyForm.show_type, this.filterManyForm.save_type, this.filterManyForm.report_type)
            }
            this.$emit('getDeviceInfo',this.deviceData.id);
            if (this.isAll) {
              this.chooseAll();
            }
            //因为后台返回时做了排序，所以不能统一到底部
            // setTimeout(function() {
            //     that.tobottom();
            // }, 1000)
          }

        }).catch(error => {
          console.log(error);

        });
        this.dialogFormVisible = false;
      },

      createT645Key() {
        if (this.addForm.slave_protocol.indexOf('2007') >= 0) {
          this.addForm.data_key = (this.addForm.sign_0 + this.addForm.sign_1 + this.addForm.sign_2 + this.addForm
            .sign_3).toUpperCase();
        } else {
          this.addForm.data_key = (this.addForm.sign_0 + this.addForm.sign_1).toUpperCase();
        }
        if (!this.changeName) {
          //如果把下面这句放在了createFirstKey里面，默认就变成了强制；
          this.addForm.sensor_name = this.addForm.data_key;
        }
      },

      //生成首个完整地址的函数
      //createFirstKey(协议，通道,数值类型,起始寻址,DB块块号)
      createFirstKey(procotol, channel, valueType, firstKey, box) {
        this.$forceUpdate();
        let char = '';
        let int = '';
        let point = '';
        let newProcotol = procotol.toLowerCase();
        if (newProcotol.indexOf('_fx_') < 0) {
          switch (channel) {
            case '0':
            case '1':
            case '3':
            case '4':
              //前缀控制
              char = channel + 'x';
              //整数部分控制
              if (Number(firstKey) >= 0 && Number(firstKey) <= 65535) {
                int = configData.padLeft(Number(firstKey) + 1, 5, '0');
              } else {
                this.$message({
                  type: 'error',
                  message: '起始地址超出范围',
                  duration: 2000,
                  center: true
                })
              }
              //小数部分控制
              if (valueType >= 50 && valueType <= 65) {
                point = '.' + configData.padLeft(valueType - 50, 2, '0');
              }
              break;
            case 'I':
            case 'Q':
              char = channel;
              //整数部分控制
              if (Number(firstKey) >= 0 && Number(firstKey) <= 9999) {
                int = firstKey;
              } else {
                this.$message({
                  type: 'error',
                  message: '起始地址超出范围',
                  duration: 2000,
                  center: true
                })
              }
              //小数部分控制
              if (valueType >= 50 && valueType <= 57) {
                point = '.' + (valueType - 50);
              }
              break;
            case 'M':
            case 'V':
              //16位数值型（不含按位）
              if ([3, 4, 13, 14].indexOf(valueType) >= 0) {
                char = channel + 'W'
                //8位数值型（不含按位）
              } else if ([1, 2, 11, 12].indexOf(valueType) >= 0) {
                char = channel + 'B'
                //32位和float数值型
              } else if ([5, 6, 9, 15, 16].indexOf(valueType) >= 0) {
                char = channel + 'D'
              } else {
                char = channel;
              }
              //整数部分控制
              if (Number(firstKey) >= 0 && Number(firstKey) <= 9999) {
                int = firstKey;
              } else {
                this.$message({
                  type: 'error',
                  message: '起始地址超出范围',
                  duration: 2000,
                  center: true
                })
              }
              //小数部分控制
              if (valueType >= 50 && valueType <= 57) {
                point = '.' + (valueType - 50);
              }
              break;
            case 'D':
              //16位数值型（不含按位）
              if ([3, 4, 13, 14].indexOf(valueType) >= 0) {
                char = 'DB' + box + '.DBW';
                //8位数值型（不含按位）
              } else if ([1, 2, 11, 12].indexOf(valueType) >= 0) {
                char = 'DB' + box + '.DBB';
                //32位和float数值型
              } else if ([5, 6, 9, 15, 16].indexOf(valueType) >= 0) {
                char = 'DB' + box + '.DBD';
              } else {
                char = 'DB' + box + '.DB';
              }
              //整数部分控制
              if (Number(firstKey) >= 0 && Number(firstKey) <= 9999) {
                int = firstKey;
              } else {
                this.$message({
                  type: 'error',
                  message: '起始地址超出范围',
                  duration: 2000,
                  center: true
                })
              }
              //小数部分控制
              if (valueType >= 50 && valueType <= 57) {
                point = '.' + (valueType - 50);
              }
              break;
            default:
              return '该数据通道不存在或尚未启用';
          }
          this.addForm.data_key = char + int + point;
        } else {
          char = channel;
          var maxFirstKey = channel == 'D' ? 99999 : 9999;
          if (Number(firstKey) >= 0 && Number(firstKey) <= maxFirstKey) {
            if (channel == 'X' || channel == 'Y') {
              //firstKey=Number(firstKey).toString(8);
              //因为个位是八进制，所以起始地址个位大于等于8时转为八进制，其他情况暂不考虑；
              let str = firstKey.toString();
              firstKey = Number(str[str.length - 1]) >= 8 ? Number(firstKey).toString(8) : Number(firstKey);
            }
            if (channel == 'D' && Number(firstKey) > 9999) {
              int = firstKey;
            } else {
              int = configData.padLeft(firstKey, 4, '0');
            }

          } else {
            this.$message({
              type: 'error',
              message: '起始地址超出范围',
              duration: 2000,
              center: true
            })
            return
          }
          this.addForm.data_key = char + int;
        }
        for (let i = 0, len = this.domains.length; i < len; i++) {
          if (this.domains[i].data_key == this.addForm.data_key) {
            return 'repeat';
          }
        }
      },

      repartValueType(protocol, type) {
        var newProtocol = protocol.toLowerCase()
        if (newProtocol.indexOf('_fx_') < 0) {
          switch (type) {
            case '0':
            case '1':
              this.valueTypes = this.valueTypes_01;
              break;
            case '3':
            case '4':
              this.valueTypes = this.valueTypes_34;
              break;
            case 'I':
            case 'Q':
              this.valueTypes = this.valueTypes_IQ;
              break;
            case 'M':
            case 'V':
            case 'D':
              this.valueTypes = this.valueTypes_MV;
              break;
          }
        } else {
          //X,Y为八进制，M,D为十进制
          switch (type) {
            case 'X':
            case 'Y':
            case 'M':
              this.valueTypes = this.valueTypes_01;
              break;
            case 'D':
              this.valueTypes = this.valueTypes_Fx_D;
              break;
          }
        }
      },


      //添加数据点时，数据通道变化引起数值类型选项变化；
      chooseValueType(type,oper) {
        this.repartValueType(this.addForm.slave_protocol, type);
          if(oper=="changeChannel"){
            if (type == "V") {
              this.addForm.value_type = 3; //V区默认16位有符号；
            } else {
              this.addForm.value_type = this.valueTypes[0].value;
            }
          }
        this.changeMinMax(this.addForm.value_type, this.addForm.magnification, this.addForm.threshold);
      },

      changeValueType(type) {
        var that = this;
        if (type == 9) {
          this.addForm.decimals = this.points[2].value;
        } else {
          this.addForm.decimals = this.points[0].value;
        }
        if(type==20){  //字符串不能批量
        	this.addForm.number=1;
        	this.addForm.show_type = 9;
        	this.addForm.threshold =0;
        	this.addForm.decimals = this.points[0].value;
        	this.addForm.value_offset=0;
        	this.options= configData.optionsForString;
        }else{
        	//this.addForm.show_type = 1;
        	this.changeDataChannel(this.addForm.data_channel,'changeValue');

        }
        this.createFirstKey(this.addForm.slave_protocol, this.addForm.data_channel, type, this.addForm.first_key, this
          .addForm.boxNum);
        if (!this.changeName) {
          //如果把下面这句放在了createFirstKey里面，默认就变成了强制；
          this.addForm.sensor_name = this.addForm.data_key;
        }
        this.changeMinMax(type, this.addForm.magnification, this.addForm.threshold);
      },

      changeMinMax(valueType, magnification, threshold) {
        //if(this.deviceData.app_scene==2){
        this.addForm.min_value = configData.defaultMinMax(valueType, magnification, threshold).min;
        this.addForm.max_value = configData.defaultMinMax(valueType, magnification, threshold).max;
        //};
      },

      changeEditMinMax(valueType, magnification, threshold) {
        //if(this.deviceData.app_scene==2){
        this.editForm.min_value = configData.defaultMinMax(valueType, magnification, threshold).min;
        this.editForm.max_value = configData.defaultMinMax(valueType, magnification, threshold).max;
        //};
      },


      //编辑数据点时，根据地址对应数值类型选项；
      addressValueType(address) {
        var type = address[0];
        this.repartValueType(this.slaveInfo.slave_protocol, type);
      },

      //数据通道变化引起首地址变化；
      changeDataChannel(dataChannel,oper) {
        this.options = configData.options;
        this.chooseValueType(dataChannel,oper);
        if (['M', '0', 'Y', 'Q'].indexOf(dataChannel) >= 0) {
          this.addForm.show_type = this.options[3].value;
          this.addForm.threshold = 1;
          this.addForm.decimals = this.points[0].value;
        } else if (dataChannel == '0') {
          this.addForm.decimals = this.points[0].value;
          this.addForm.show_type = this.options[0].value;
          this.addForm.threshold = 1;
        } else if (dataChannel == '1') {
          this.addForm.decimals = this.points[0].value;
          this.addForm.show_type = this.options[4].value;
          this.addForm.threshold = 1;
        } else if (dataChannel == 'X' || dataChannel == 'I') {
          //三菱协议X区只有只读类型
          this.options = configData.optionsOnlyRead;
          this.addForm.show_type = this.options[2].value;
          this.addForm.decimals = this.points[0].value;
          this.addForm.threshold = 1;
        } else {
          this.addForm.show_type = this.options[0].value;
          this.addForm.threshold = 0;
        }
        this.$forceUpdate();
        this.createFirstKey(this.addForm.slave_protocol, dataChannel, this.addForm.value_type, this.addForm.first_key,
          this.addForm.boxNum);
        if (!this.changeName) {
          //如果把下面这句放在了createFirstKey里面，默认就变成了强制；
          this.addForm.sensor_name = this.addForm.data_key;
        }
      },

      changeSensorName(name) {
        this.changeName = name == this.addForm.data_key ? false : true;
      },

      changeFirstKey(firstKey) {
        this.createFirstKey(this.addForm.slave_protocol, this.addForm.data_channel, this.addForm.value_type, firstKey,
          this.addForm.boxNum);
        if (!this.changeName) {
          //如果把下面这句放在了createFirstKey里面，默认就变成了强制；
          this.addForm.sensor_name = this.addForm.data_key;
        }
      },

      changeBoxNum(boxNum) {
        this.createFirstKey(this.addForm.slave_protocol, this.addForm.data_channel, this.addForm.value_type, this
          .addForm.first_key, boxNum);
        if (!this.changeName) {
          //如果把下面这句放在了createFirstKey里面，默认就变成了强制；
          this.addForm.sensor_name = this.addForm.data_key;
        }
      },

      addSensors(type) {
        var that = this;
        this.changeName = false;
        this.addForm = type == 'virtual' ? Object.assign({}, that.addVirtualForm) : Object.assign({}, that.addRealForm);
        this.addForm.slave_name = this.slaveInfo.slave_name ? this.slaveInfo.slave_name : this.slaveName;
        this.addForm.slave_protocol = this.slaveInfo.slave_protocol ? this.slaveInfo.slave_protocol : this
        .slaveProtocol;
        this.addForm.channel_type = this.slaveInfo.channel.channel_type ? this.slaveInfo.channel.channel_type : this
          .channelName;
        this.addForm.sensor_name = '';
        this.addForm.data_key = '';
        this.addForm.decimals = this.points[0].value;
        this.getTeamAll(this.deviceData.id);
        //默认分组操作
        setTimeout(function() {
          if (that.groups.some(function(item, index, arr) {
              return item.label == that.addForm.slave_name || item.label.indexOf(that.addForm.slave_name) >= 0;
            })) {
            for (let i = 0, len = that.groups.length; i < len; i++) {
              if (that.groups[i].label.indexOf(that.addForm.slave_name) >= 0) {
                that.addForm.sgroup_id = that.groups[i].value;
                break;
              }
            }
          } else {
            that.addForm.sgroup_id = that.groups.length?that.groups[0].value:'';
          }
        }, 1000)
        if (type == 'real') { //实际变量
          this.addForm.value_key = '';
          this.addForm.boxNum = 1; //默认DB块号
          this.addForm.first_key = 0;
          this.addForm.number = 1; //新增数量
          this.addForm.magnification = 1;
          if (this.deviceData.app_scene == 1) {
            //delete this.addForm.min_value;
            //delete this.addForm.max_value;
            delete this.addForm.mark;
          }
          console.log("a");
          if (this.addForm.slave_protocol.indexOf('odbus') >= 0) {
            this.dataChannels = this.addSensor_modbus;
          } else if (this.addForm.slave_protocol.indexOf('_200') >= 0) {
            this.dataChannels = this.addSensor_s7200;
          } else if ((this.addForm.slave_protocol.indexOf('_1200') >= 0) || (this.addForm.slave_protocol.indexOf(
              '_1500') >= 0) || (this.addForm.slave_protocol.indexOf('300') >= 0)) {
            this.dataChannels = this.addSensor_1200_1500;
          } else if (this.addForm.slave_protocol.indexOf('_fx_') >= 0) {
            this.dataChannels = this.addSensor_mitsubishi_fx;
          }
          console.log("b");
          if (this.addForm.slave_protocol.indexOf('1997') >= 0) {
            this.addForm.sign_0 = "00";
            this.addForm.sign_1 = "00";
            this.addForm.data_key = "0000";
          } else if (this.addForm.slave_protocol.indexOf('2007') >= 0) {
            this.addForm.sign_0 = "00";
            this.addForm.sign_1 = "00";
            this.addForm.sign_2 = "00";
            this.addForm.sign_3 = "00";
            this.addForm.data_key = "00000000";
          } else {
            delete this.addForm.sign_0;
            delete this.addForm.sign_1;
            delete this.addForm.sign_2;
            delete this.addForm.sign_3;
          }
          console.log("c");

          //modbus系列协议默认为4区(王总)
          if (this.addForm.slave_protocol.indexOf('645') <= 0) {
            if (this.addForm.slave_protocol.indexOf('odbus') >= 0) {
              this.addForm.data_channel = this.dataChannels[3].value;
            } else {
              this.addForm.data_channel = this.dataChannels[0].value;
            }
            this.options = configData.options;
            this.chooseValueType(this.addForm.data_channel[0],'changeChannel');
            if (['M', '0', 'Y', 'Q'].indexOf(that.addForm.data_channel) >= 0) {
              this.addForm.show_type = this.options[3].value;
              this.addForm.threshold = 1;
            } else if (this.addForm.data_channel == 'X' || this.addForm.data_channel == 'I') {
              //三菱协议X区只有只读类型
              this.options = configData.optionsOnlyRead;
              this.addForm.show_type = this.options[2].value;
              this.addForm.threshold = 1;
            } else {
              this.addForm.show_type = this.options[0].value;
              this.addForm.threshold = 0;
            }
            this.createFirstKey(this.addForm.slave_protocol, this.addForm.data_channel, this.addForm.value_type, this
              .addForm.first_key, this.addForm.boxNum)
          } else {
            this.addForm.show_type = this.options[0].value;
            this.addForm.threshold = 0;
            this.addForm.value_type = this.valueTypes_T645[0].value;
          }
          this.addForm.sensor_name = this.addForm.data_key;
          this.$forceUpdate();
          this.changeMinMax(this.addForm.value_type, this.addForm.magnification, this.addForm.threshold);
        } else { //虚拟变量
          this.oper = "add";
          this.drawerShow = false;
          //this.sensorString = '';
          this.addForm.formula = "";
          this.addForm.data_key = 'var_1';
          this.addForm.show_type = this.options[0].value;
          this.addForm.threshold = 0;
          this.addForm.magnification = 1;
          this.addForm.value_offset = 0;
          this.getSlaveSensorTree(this.deviceData.id);
          setTimeout(function() {
            that.drawerShow = true;
          }, 500)
        }

        //下面的默认排序号是当前排序号的最大值加1
        if (this.domains.length) {
          let max = Number(this.domains[that.domains.length - 1].list_order) || 1;
          for (let i = 0, len = this.domains.length; i < len; i++) {
            if (Number(this.domains[i].list_order) || Number(this.domains[i].list_order) == 0) {
              max = max < Number(this.domains[i].list_order) ? Number(this.domains[i].list_order) : max;
            }
          }
          this.addForm.list_order = max + 1;
        } else {
          this.addForm.list_order = 1;
        }
        this.dialogFormVisible = true;
      },

      cancelAdd() {
        this.dialogFormVisible = false;
        //this.addForm.visible = false;
      },

      changeTemplate() {
        var that = this;
        if (this.setForm.template_name == 0) {
          this.more = false;
          this.more_2 = false;
        } else {
          this.getTeamAll(this.deviceData.id, false);

        }
        for (let i = 0; i < this.moulds.length; i++) {
          if (this.moulds[i].value == this.setForm.template_name) {
            this.templateId = this.moulds[i].value;

          }
        }
        if (this.setForm.template_name != 0) {
          if (this.isExam) {
            this.cancelConnect();
          }
          this.$http({
            method: 'post',
            url: 'api/template/info',
            data: {
              "id": this.templateId

            }
          }).then(res => {
            if (res && res.data.result == "success") {

              this.domains2 = res.data.data.sensors;
              //console.log(res.data.data);
              for (let i = 0, len = res.data.data.sensors.length; i < len; i++) {
                if (res.data.data.sensors[i].show_type > 2) {
                  that.domains2[i].decimals = 0;
                  that.domains2[i].unit = '';
                }

                switch (Number(res.data.data.sensors[i].save_type)) {
                  case 1:
                    that.domains2[i].save_type = '存储';
                    break;
                  case 2:
                    that.domains2[i].save_type = '不存储';
                    break;
                  case 3:
                    that.domains2[i].save_type = '变化存储';
                    break;

                }

              }
              this.getTeamAll(this.deviceData.id, false);
            }

          }).catch(error => {
            console.log(error);

          });
        } else {
          that.getSensor(that.slaveId);
        }

      },

      filterMany() {
        var that = this;
        this.getTeamAll(this.deviceData.id, false);
        this.filterShowTypes = [{
          value: '',
          label: '全部'
        }, ...configData.options];
        this.filterSaveTypes = [{
          value: '',
          label: '全部'
        }, ...this.saves];
        this.filterReportTypes = this.deviceData.version==3?[{
          value: '',
          label: '全部'
        }, ...this.reportTypes]:[{
          value: '',
          label: '全部'
        }, ...this.reportTypes_54];
        setTimeout(function() {
          that.filterGroups = [{
            value: '',
            label: '全部'
          }, ...that.groups];
        }, 1000);
        this.filterManyForm = {
          sensor_name: '',
          sgroup_id: '',
          show_type: '',
          save_type: '', //1存储，2不存储，3变化存储
          report_type: ''
        }
        this.manyFilterVisible = true;

      },

      filterManySensor(sgroup_id, keyword, show_type, save_type, report_type) {
        this.isFilter = false;
        this.getSensor(this.slaveId, sgroup_id, keyword, show_type, save_type, report_type);
        //this.manyFilterVisible = false;
        this.isFilter = true;
      },

      closeFilter() {
        this.manyFilterVisible = false;
        //this.isFilter = false;
      },

      cancelFilter() {
        this.isFilter = false;
        this.filterManyForm = {
          sensor_name: '',
          sgroup_id: '',
          show_type: '',
          save_type: '', //1存储，2不存储，3变化存储
          report_type: ''
        };
        this.getSensor(this.slaveId);
        this.isFilter = true;
      },

      updateMany() {
        var that = this;
        if (!this.chooseArray.length) {
          this.$message({
            type: 'info',
            duration: 2000,
            offset: 300,
            message: '你还没有选择要修改的数据点，请先点击方框选择！'
          });
          return false;
        }
        this.getTeamAll(this.deviceData.id);
        this.editManyForm = {
          edit_which: 'magnification',
          show_type: 1,
          save_type: 2, //1存储，2不存储，3变化存储
          magnification: 1,
          value_offset: 0,
          threshold: 1,
          unit: '',
          report_type: 0,
          decimals: 0,
          sgroup_id: ''
        };
        setTimeout(function() {
          that.editManyForm.sgroup_id = that.groups[0].value;
        }, 1000)
        this.manyUpdateVisible = true;

      },

      updateManyHappen() {
        var that = this;
        this.$http({
          method: 'post',
          url: 'api/sensor/batchUpdate',
          data: {
            "id": that.chooseArray.join(','),
            [that.editManyForm.edit_which]: that.editManyForm[that.editManyForm.edit_which]
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '恭喜,批量修改数据点成功!',
              type: 'success',
              duration: 2000,
              offset: 300,
              center: true
            });
            this.isAll = false;
            this.chooseArray = [];
            this.manyUpdateVisible = false;
            if (!this.manyFilterVisible) {
              this.getSensor(this.slaveId);
            } else {
              this.getSensor(this.slaveId, this.filterManyForm.sgroup_id, this.filterManyForm.sensorKey, this
                .filterManyForm.show_type, this.filterManyForm.save_type, this.filterManyForm.report_type)
            }

          }

        }).catch(error => {
          console.log(error);

        });
      },

      cancelUpdateMany() {
        this.manyUpdateVisible = false;
      },

      deleteMany() {
        if (!this.chooseArray.length) {
          this.$message({
            type: 'info',
            duration: 2000,
            offset: 300,
            message: '你还没有选择要删除的数据点，请先点击方框选择！'
          });
          return false;
        }
        this.$confirm('删除后无法恢复, 你将无法查看他们的数据，是否确认删除这些数据点?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.removeMany();
        }).catch(() => {
          //this.$message({
          // type: 'info',
          // duration:2000,
          // offset:300,
          // message: '已取消删除'
          //});
        });
      },

      removeMany() {
        var that = this;
        this.$http({
          method: 'post',
          url: 'api/sensor/batchDelete',
          data: {
            "id": that.chooseArray.join(',')
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '恭喜,批量删除数据点成功!',
              type: 'success',
              duration: 2000,
              offset: 300,
              center: true
            });
            this.isAll = false;
            this.chooseArray = [];
            if (!this.manyFilterVisible) {
              this.getSensor(this.slaveId);
            } else {
              this.getSensor(this.slaveId, this.filterManyForm.sgroup_id, this.filterManyForm.sensorKey, this
                .filterManyForm.show_type, this.filterManyForm.save_type, this.filterManyForm.report_type)
            }
            this.$emit('getDeviceInfo',this.deviceData.id);
          }

        }).catch(error => {
          console.log(error);

        });
      },

      modifySet() {
        this.$http({
          method: 'post',
          url: 'api/slave/importFromTemplate',
          data: {
            "id": this.slaveId,
            "template_id": this.templateId,
            "sgroup_id": this.setForm.sgroup_id
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '恭喜,设备配置成功!',
              type: 'success',
              duration: 2000,
              offset: 300,
              center: true
            });
            this.infoShow = "slave";
            this.setForm.template_name = 0;
            this.getSensor(this.slaveId);
          }

        }).catch(error => {
          console.log(error);

        });
      },
      //------------分组管理相关函数；
      //分组获取，用于下拉
      getTeamAll(id, defaultFirst = true) {
        this.groups = [];
        this.$http({
          method: 'post',
          url: 'api/sensorGroup/all',
          data: {
            "equip_id": id,
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            if (res.data.data.length) {
              for (let i = 0; i < res.data.data.length; i++) {
                let group = {
                  value: res.data.data[i].id,
                  label: res.data.data[i].sgroup_name
                };
                this.groups.push(group);
              }
              this.setForm.sgroup_id = this.groups[0].value;
              if (!defaultFirst) {
                for (let i = 0; i < this.groups.length; i++) {
                  if (this.groups[i].label == this.slaveName) {
                    this.setForm.sgroup_id = this.groups[i].value;
                    break;
                  }
                }
              }
            }
          }
        }).catch(error => {
          console.log(error.message);

        });
      },
      //分组列表获取
      showList(num = 1, size = 5) {
        this.teamListVisible = true;
        this.$http({
          method: 'post',
          url: 'api/sensorGroup/lists',
          data: {
            "equip_id": this.deviceData.id,
            "page": num,
            "limit": size
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.tabledata = res.data.data;
            this.queryParams.total = res.data.count;
            if (!this.tabledata.length && num > 1) {
              this.showList(this.queryParams.pageNo--, size);
            }
          }
        }).catch(error => {
          console.log(error.message);
        });
      },

      current_change: function(currentPage) {
        this.queryParams.pageNo = currentPage;
        this.showList(currentPage, this.queryParams.pageSize);
        //console.log(currentPage)
      },
      handleSizeChange(val) {
        this.queryParams.pageSize = val;
        this.showList(this.queryParams.pageNo, val);
      },

      addTeam() {
        this.teamAddVisible = true;
        this.addTeamForm = {
          sgroup_name: '',
          list_order: 1
          //sgroup_icon:'',
          //sgroup_desc:''
        };

      },

      sureAddTeam() {
        this.$http({
          method: 'post',
          url: 'api/sensorGroup/add',
          data: {
            'equip_id': this.deviceData.id,
            'sgroup_name': this.addTeamForm.sgroup_name,
            'list_order': this.addTeamForm.list_order
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '添加分组成功!',
              type: 'success',
              center: true
            });
            this.showList(this.queryParams.pageNo, this.queryParams.pageSize);
            if (this.setForm.template_name != 0) {
              this.getTeamAll(this.deviceData.id, false);
            }
          }
        }).catch(error => {
          console.log(error.message);

        });
        this.teamAddVisible = false;
      },

      cancelEdit() {
        this.teamEditVisible = false;
        //取消时要清空，否则会缓存
        this.editTeamForm = {};
      },

      editTeam(row) {
        this.teamEditVisible = true;
        //像对象这种引用型数据不能直接用“=”，会相互影响
        function copy(obj) {
          return Object.assign({}, obj);
          //return {...obj};//也可以用扩展运算符
        }
        this.editTeamForm = copy(row);
      },

      sureEditTeam() {
        this.$http({
          method: 'post',
          url: 'api/sensorGroup/update',
          data: {
            'id': this.editTeamForm.id,
            'sgroup_name': this.editTeamForm.sgroup_name,
            'list_order': this.editTeamForm.list_order
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '修改分组成功!',
              type: 'success',
              center: true
            });
            this.showList(this.queryParams.pageNo, this.queryParams.pageSize);
            this.getSensor(this.slaveId);
            if (this.setForm.template_name != 0) {
              this.getTeamAll(this.deviceData.id, false);
            }

          }
        }).catch(error => {
          console.log(error.message);

        });
        this.teamEditVisible = false;
      },

      sureDeleteTeam(row) {
        this.$confirm('删除后无法恢复, 是否确认删除该传感器分组?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.deleteTeam(row);
        }).catch(() => {
          //this.$message({
          // type: 'info',
          // message: '已取消删除'
          //});
        });
      },

      deleteTeam(row) {
        this.$http({
          method: 'post',
          url: 'api/sensorGroup/delete',
          data: {
            id: row.id
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            this.$message({
              message: '删除分组成功!',
              type: 'success',
              center: true
            });
            this.showList(this.queryParams.pageNo, this.queryParams.pageSize);
            if (this.setForm.template_name != 0) {
              this.getTeamAll(this.deviceData.id, false);
            }
          }
        }).catch(error => {
          console.log(error.message);

        });
      },

      closeTeamList() {
        this.teamListVisible = false;
        if (this.isExam) {
          this.refreshDataAll();
        }
        if (this.isAll) {
          this.chooseAll();
        }
      },

      varStringHelp(type) {
        this.drawerShow = !this.drawerShow;
      },

      //获取设备的从机变量树
      getSlaveSensorTree(id) {
        var that = this;
        this.sensorTree = [];
        this.$http({
          method: 'post',
          url: 'api/equip/sensorTree', //该接口已去掉虚拟变量
          data: {
            "id": id,
          }
        }).then(res => {
          if (res && res.data.result == "success") {
            if (res.data.data.length) {
              this.sensorTree = Array.from(res.data.data);
              this.$forceUpdate();
            }
          }
        }).catch(error => {
          console.log(error);
        });
      },

      filterNode(value, data) {
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      },

      getSensorString(data, node, ele) {
        //console.log(data);
        if (!data.data_key) {
          return
        }
        this.sibling = ele.$el.parentNode.children;
        // for(let i=0;i<this.sibling.length;i++){
        // 	  this.sibling[i].style.color="#333";
        // }
        ele.$el.style.color = "#409eff";
        let str = '$devices["' + data.slave_no + '"]["variables"]["' + data.data_key + '"]';
        if (this.oper == "add") {
          this.addForm.formula = (this.addForm.formula + '  ' + str).trim();
        } else if (this.oper == "edit") {
          this.editForm.formula = (this.editForm.formula + '  ' + str).trim();
        }
      },

      // reSetString(){
      // 	this.sensorString="";
      // 	for(let i=0;i<this.sibling.length;i++){
      // 		this.sibling[i].style.color="#333";
      // 	}
      // }

      // fillString(type){
      // 	if(this.sensorString){
      // 	    //if(type=="add"){
      // 	       // this.addForm.formula=this.sensorString.trim();
      // 		//}else if(type=="edit"){
      // 			this.editForm.formula=this.sensorString.trim();
      // 		//}
      // 	}
      // }
    },

    beforeDestroy() {
      if (this.isExam) {
        this.cancelConnect();
      }
      this.$message.closeAll();
    },

    destroyed() {
      var that = this;
      clearTimeout(that.stateTimer);
      clearInterval(that.timer);
      clearInterval(that.tokenTimer);
      if (this.Socket) {
        this.Socket.close();
        this.Socket.onerror = null;
      }

    }
  }
</script>

<style scoped>
  @media all and (max-width:2560px) {
    .mar_5 {
      margin-left: -0.2rem !important;
    }
    .slaveLine{
       width:4.2rem!important;
    }
  }

  @media all and (max-width:1920px) {
    .mar_5 {
      margin-left: -0.7rem !important;
    }
    .slaveLine{
       width:2.8rem!important;
    }
  }

  @media all and (max-width:1600px) {
    .mar_5 {
      margin-left: -1.2rem !important;
    }

    .slaveInfo {
      height: 4.2rem !important;
    }

    .block {
      margin-left: -0.4rem !important;
    }

    .inpu_3 {
      width: 4.5rem !important;
    }

    .triVal {
      width: 2rem !important;
    }

    .btnBox>>>.el-input__inner {
      height: 1rem;
      line-height: 1rem;
    }

    .custom-tree-node {
      font-size: 0.25rem !important;
    }
  }

  @media all and (max-width:1440px) {
    .slaveLine{
       width:2.25rem!important;
    }

  }

  @media all and (max-width:1366px) {
    .slaveInfo {
      margin-top: 2px !important;
      height: 3.8rem !important;
    }

    .for_1366 {
      margin-top: -0.6rem !important;
    }

    .channelHead {
      min-height: 1.6rem !important;
      max-height: 3.2rem !important;
      margin-bottom: 0 !important;
    }

    .mar_5 {
      margin-left: -1.5rem !important;
    }

    .pari {
      margin-top: 1rem !important;
    }

    .slaveInpu_2 {
      width: 3.6rem !important;
    }

    .addform {
      margin-top: -0.3rem !important;
    }

    .slaveInfo /deep/ .el-input__inner,
    .slaveInfo_3 /deep/ .el-input__inner,
    .argmentBox /deep/ .el-input__inner,
    .inpu /deep/ .el-input__inner,
    .inpu_2 /deep/ .el-input__inner,
    .inpu_3 /deep/ .el-input__inner,
    .inpu_5 /deep/ .el-input__inner,
    .inpu /deep/ .el-textarea__inner {
      height: 0.8rem !important;
      line-height: 0.8rem !important;
      padding: 0 2px;
      font-size: 0.3rem !important;
      padding-right: 0 !important;
    }
  }

  @media all and (max-width:1024px) {
    .btn_1360 {
      width: 1.6rem !important;
      font-size: 0.28rem !important;
      padding: 4px !important;
    }
  }

  @keyframes moveToleft {
    0% {
      left: 50%;
      bottom: 50%;
      transform: translate(-50%, 50%);

    }

    /* 50%可以没有 */
    /* 50% {
		  left:25%;
		  bottom:25%;
		  transform:translate(-25%,25%);

		} */

    100% {
      left: 0;
      bottom: 0;
    }
  }

  .page{
    width:99.1%;
    height:calc(100vh - 1rem)!important;
    margin:0 auto!important;
    padding:0!important;
    /* margin-top:-0.3rem!important; */
    /* border:1px  solid blue; */
  }

  #channel {
    transition: all 1s linear;
  }

  .channel {
    float: left;
    width: 14.2%;
    height: calc(100vh - 2.1rem);
    position:absolute;
    left:0.1rem;
    z-index: 1;
    border-right: 1px solid #ccc;
    padding-right: 0.1rem;
    padding-bottom: 0.1rem;
    overflow: auto;
  }

  .channelHidden {
    float: left;
    width: 0;
    height: 0;
    border: none;
    overflow: hidden;
    padding: 0 !important;
  }

  .channelBack {
    display: inline-block;
    position:fixed;
    width: 0.5rem;
    height: 0.5rem;
    font-size: 0.4rem;
    padding-top: 1px;
    border-radius: 50%;
    color: #fff;
    left: calc(14.2% - 0.6rem);
    bottom: 0.1rem;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    cursor:pointer;
  }

  .channelHead {
    text-align: left;
    min-height: 1.2rem;
    max-height: 2.2rem;
    line-height: 1rem;
    margin-bottom: 0.3rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px dashed #ccc;
  }

  .channelBtnBox{
  	width:90%;
  	text-align:center;
  	/* border:1px solid red; */
  }

  .slave,
  .slaveScreen {
    float: right;
    width: 85.2%;
    height: calc(100vh - 2rem);
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    transition: all 1s linear;
    /*14.6rem*/
    /* border:1px solid red; */
    padding-bottom: 0.1rem;
    overflow:hidden;
  }

  .slaveScreen {
    width: 100% !important;
  }

  .channelShow {
    display: inline-block;
    position: fixed;
    width: 0.5rem;
    height: 0.5rem;
    font-size: 0.4rem;
    padding-top: 1px;
    border-radius: 50%;
    color: #fff;
    left: 0.1rem;
    bottom: 0.1rem;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    cursor:pointer;
  }

  .mar_right_2{
    margin-right:0.14rem;
  }

  .mar_right_3{
    margin-right:0.3rem;
  }

  .header_bottom{
     height:0.6rem;
     line-height:0.7rem;
     margin-top:0.1rem;
  }

  .header_bottom /deep/ .el-button{
     margin-top:0.06rem!important;
     vertical-align:top;
  }

  #goback{
    margin-top:1px;
  }

  /* .header_bottom{
    display:block;
  }

  .header_bottom /deep/ .el-button+.el-button{
     margin:0 8px!important;
  } */

  .filterBox {
    height: 45%;
    background-color: #fff;
    position: fixed;
    z-index: 99;
    box-shadow: 0px 0px 8px #666;
    text-align: left;
    transition: all 500ms linear;
  }

  .filterBoxCenter {
    width: 22%;
    left: 50%;
    bottom: 50%;
    transform: translate(-50%, 50%);
    padding: 0.2rem 0.2rem 0 0.4rem;
  }

  .filterBoxLeft {
    width: 14.7%;
    padding: 0.2rem 0.2rem 0 0;
    left: 0;
    bottom: 0;
    margin: 0;
    -webkit-animation: moveToleft 500ms linear;
    animation: moveToleft 500ms linear;

  }

  .channelIcon{
    width:0.34rem;
    height:0.34rem;
    vertical-align: middle;

  }

  .slaveLine{
    display:inline-block;
    width:2.85rem;
    /* border:1px solid red; */
    overflow:hidden;
  }

  .custom-tree-node {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    font-size: 14px;
    padding-right: 4px;
    width:100%;
    /* border:1px solid red; */
  }

  .inpu {
    vertical-align: middle;
    width: 5rem;
  }

  .slaveInpu_2 {
    vertical-align: middle;
    width: 3.2rem;
  }

  .slaveInpu_2 /deep/ .el-input__inner {
    padding-left: 4px;
    padding-right: 2px;
  }

  .tip {
    display: block;
    width: 100%;
    text-align: center;
    color: red;
    font-size: 0.25rem;
    margin-top: 0.2rem;
  }

  .tip_1 {
    color: #FF5722;
    width: 2.5rem;
    font-size: 0.25rem;
    margin-top: 0.1rem;
    line-height: 0.3rem;
    overflow: visible;
    /* margin-bottom:0rem; */
  }

  .tip_2 {
    float: left;
    width: auto;
    color: red;
    font-size: 0.35rem;
    font-weight: 550;
   margin-left: 0.3rem;
    vertical-align: middle;
  }

  .choice {
    display: inline-block;
    font-size: 0.3rem;
    text-indent: 0.3rem;
  }

  .add {
    font-size: 0.3rem;
    color: #409Eff;
    border: 1px solid #409Eff;
  }

  .infobox {
    width: 100%;
    height: auto;
    border-top: 1px solid #ccc;
    margin-top: 0.2rem;
  }

  .slaveInfo,
  .slaveInfo_3 {
    width: 100%;
    height: 3.2rem;
    margin-top: 0.2rem;
    border-bottom: 1px solid #ccc;
    position: relative;
  }

  .slaveInfo_3 {
    height: 0.8rem;
    line-height: 0.8rem;
    margin-top: 0;
    /* display:flex;
		justify-content:space-around; */
  }

  .slaveInfo /deep/ .el-input__inner,
  .slaveInfo_3 /deep/ .el-input__inner,
  .argmentBox /deep/ .el-input__inner,
  .inpu /deep/ .el-input__inner,
  .inpu_2 /deep/ .el-input__inner,
  .inpu_3 /deep/ .el-input__inner,
  .inpu_5 /deep/ .el-input__inner,
  .inpu /deep/ .el-textarea__inner {
    padding: 0 4px;
    padding-right: 0 !important;
  }

  .argmentBox {
    width: 100%;
    margin-top: 0.3rem;
    height: auto;
    /* border: 1px dashed #ccc; */
    position: relative;
    padding-bottom: 0.1rem;
  }

  .addform {
    text-align: left;
    /* padding-left: 80px; */
    height: 0.8rem;
    line-height: 0.8rem;
    /* margin-top: 0.1rem; */
  }

  .formline_1 {
    height: 0.6rem;
    line-height: 0.6rem;
  }

  .sendSet {
    float: right;
    vertical-align: bottom;
  }

  .formline_2 {
    width: 32%;
    display: inline-block;
    margin: 0 auto !important;
    height: 1rem;
    line-height: 1rem;
  }

  .inpu {
    display: inline-block;
    width: 5.5rem;
    font-size: 0.25rem;
  }

  .inpu_2 {
    display: inline-block;
    width: 2.4rem;
    font-size: 0.25rem;
    vertical-align: top;
    border: 1px solid #ccc;
    border-radius: 5px;
    height: 0.6rem;
    margin-left: -0.1rem;
    line-height: 0.6rem;
    text-align: center;
    margin-top: 0.1rem;
  }

  .inpu_3,
  .inpu_5 {
    display: inline-block;
    width: 4rem;
    height: 0.6rem;
    line-height: 0.6rem;
    vertical-align: middle;
    margin-left: -0.1rem;
    overflow: visible;
    font-size: 0.25rem;
  }

  .inpu_5 {
    width: 1.4rem;
    /* vertical-align:top; */
  }

  .manyForm .inpu_3 {
    vertical-align: top !important;
  }

  .triVal {
    width: 1.75rem;
  }

  .triVal /deep/ .el-input__inner {
    padding: 0 4px;
  }

  .thumb {
    width: 1rem;
    height: 1rem;
    vertical-align: middle;
  }

  .iconbtn {
    width: 1rem;
    height: 1rem;
    vertical-align: middle;
    padding: 0;
    border: none;
  }

  .btnBox {
    width: 100%;
    /* padding-left:0.6rem; */
    text-align: left;
    height: 1rem;
    line-height: 1rem;
    /* border:1px solid red; */
    margin-top: 0;
  }

  .channel_sign {
    color: #111111 !important;
    border-bottom: 1px dashed #ccc;
  }

  .equipArg>>>.el-form-item__label {
    color: deepskyblue !important;
  }

  .arg>>>.el-form-item__label {
    font-weight: 600;
    font-size: 0.3rem;
  }

  .teamList>>>.el-dialog__body {
    padding: 15px 10px;
  }

  .container_table {
    min-height: 10rem;
    max-height: 13rem;
    overflow: auto;
    /* border: 1px solid red; */
  }

  #transfer /deep/ .el-transfer-panel__list {
    padding-bottom: 0.8rem;
  }

  .dial>>>.el-dialog__header {
    position: relative;
    z-index: 99;
    width:100%;
    height: 0.8rem;
    background-color: transparent !important;
    /* border:1px solid red; */
  }

  .dial>>>.el-dialog__body {
    /*曲线对话框的背景色*/
    padding: 10px;
    line-height: 1rem;
  }

  .infocontent {
    line-height: 0.42rem;
  }

  .infocontent h4 {
    font-weight: 700;
    color: #111;
    margin-top: 0.3rem;
  }

  .rightBox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    width: 18%;
    box-sizing: border-box;
    opacity: 1;
    overflow: auto;
    /* height:100%; */
    padding: 0.2rem;
    padding-top: 0.1rem;
    background-color: #fff;
    box-shadow: 2px 2px 12px #666;
    border-radius: 4px 0 0 4px;
    transition: all 500ms linear;
    /* border:1px solid red; */
  }

  .zeroWidth {
    box-sizing: border-box;
    width: 0 !important;
    opacity: 0;
    overflow: hidden;
  }

  .rightBox h4 {
    width: 100%;
    font-size: 0.3rem;
    font-weight: normal;
    /* font-weight:700; */
    height: 0.8rem;
    line-height: 0.8rem;
    border-bottom: 1px solid #ccc;

  }

  .sensorTree {
    min-height: 1rem;
    /* max-height: calc(100% - 5.6rem); */
    max-height: calc(100% - 1.2rem);
    box-sizing: border-box;
    border-radius: 5px;
    margin-top: 0.2rem;
    padding-top: 0.1rem;
    overflow: auto;
    color: #333;
    border: 1px solid #ccc;
  }

  /* .addSensorTree{
		max-height: calc(100% - 1.2rem)!important;
	}

	.editSensorTree{
		max-height: calc(100% - 5.6rem)!important;
	} */

  .sensorTree /deep/ .el-tree-node__content .el-tree-node__label {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .sensorTree /deep/ .el-tree-node__content .is-leaf {
    width: 0 !important;
    height: 0 !important;
    padding: 3px !important;
    overflow: hidden;
    /* padding-left:28px!important; */
  }

  .formline_2 /deep/ .el-textarea__inner {
    padding-left: 2px;
    padding-right: 2px;
  }

  .addform /deep/ .el-radio .el-radio__label{
     padding-left:4px!important;
  }

  .slaveActtive{
      color:deepskyblue!important;
  }

  /* .stringBox{
		box-sizing:border-box;
		margin-top:0.2rem;
		min-height:4rem;
		line-height:0.7rem;
	} */

  /* .sensorString{
		display:inline-block;
		width:100%;
		border:1px solid #ccc;
		border-radius: 2px;
		padding-left:2px;
		padding-right:2px;
		height:0.6rem;
		line-height:0.6rem;
	} */

  /* .stringBox /deep/ .el-textarea__inner{
		height:auto;
		padding-left:2px;
		padding-right:2px;
	} */
</style>
